package ui;

import engine.ani.Player;
import engine.goods.Goods;
import engine.net.NetManager;
import engine.skill.SkillBuffManager;
import function.Equipment;
import function.Friend;
import function.GameSet;
import function.NPCTalk;
import function.Pet;
import function.Property;
import function.QuickOption;
import function.Store;
import function.SysMessage;
import function.Team;
import function.Tong;
import java.util.Random;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import mainpackage.Constant;
import mainpackage.GameBean;
import mainpackage.InputInterFace;
import mainpackage.MainCanvas;
import mainpackage.MainGame;
import mainpackage.MainLogic;
import mainpackage.MainView;
import mainpackage.ResManager;
import mainpackage.Rms;
//#if NOKIAN73 || NOKIA_S40V3 || MOTO || K790 
//#else
import mainpackage.SoundPlayerUtil;
//#endif
import mainpackage.Tools;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 * <p>Title: 游戏界面类</p>
 * <p>Description: 主要负责游戏逻辑更新</p>
 * <p>Copyright: Copyright (c) 2010</p>
 * <p>Company: </p>
 * @author hlw
 * @version 1.0
 */
public class UiInterFace {
    //游戏状态

    public byte byUiState;
    //需要等待的页面的公用等待状态
    private int iState;
    public int iSelectIndex;
    private int iSubSelectIndex;
    private byte tempIndex;//由一级菜单进入二级菜单时用于记录一级菜单的位置
    //键盘锁定
    public boolean bUiKeyPressLock;
    //时间延迟计数
    //存INT储数组
    public int[] iArray;
    //ui界面下公用图片数组
    public Image[] imgUiArray;
    public Player[] animation;
    //下个UI状态
    private byte byNextState = 0;
    //提示界面的UI图片数组
    private boolean bFlag;
    private int iPositionY;
    //漫游界面下用到的图片
    public Image[] roamImgUiArray;
    private Image[] menuImgUiArray;
    public int iRoamPositionX;
    public String[][] sData;
    public String[] sArray;
    public static String sRoamMapKeys;
    public static String sRoamMapName;
    //公用临时存储数据容器
    public String[] sDataArray;
    //漫游界面下跑马灯的文字
    public String sMarquee;
    private String tips;
    public int iCount;
    //方向
    public int[] loadingAni; //loading动画
    public static byte byMaxLoadingNum = 0; //当前loading条可以最大增加到多少数字？(最大100)
    public String[] menu;//弹出菜单内容
    private short menuWidth = 0;//菜单宽度
    public short menuHeight = 0;//菜单高度
    public short menuH;//每条menu菜单的高度
    private short menuSpaceH;//每2个menu间的间隔高度
    private byte menuSelectIndex;//菜单选择索引，从1开始
    private int menuPositionY = 0;
    private byte bySelectNum;//界面中选择项数目，因列表界面的选择项是不确定的
    private byte byMaxNum;//每页最多显示玩家数量
    private short playerNum;//玩家个数
    private long[] playerId;//玩家ID
    private String[] playerName;//玩家姓名
    private short shCurrentPage;//当前页
    private short shTotalePage;//总页数
    private int startX;
    private int startY;
    public static boolean isOpenSound = true;//是否播放音乐的版本
    public static boolean SetPlayMusic;//是否播放音乐
    public static boolean firstUiMusic;//在漫游界面下第一次播放音乐
    public short shHeight = 0;
    private short[] otherPlayerLv;
    private String otherPlayerName;
    private String sIntegral;
    private int selectColor = 0x00CCFF;
    private int blackColor = 0x000000;
    private int whiteColor = 0xFFFFFF;
    private byte[] byData;
    private Random random;
    public byte[] byIndex;
    //队伍
    public static Team team = new Team();
    //系统提示信息
    public static SysMessage sysMessage = new SysMessage();
    //npc对话任务，买卖物品,任务
    public static NPCTalk npcTalk = new NPCTalk();
    //帮派
    public static Tong tong = new Tong();
    //宠物
    public static Pet pet = new Pet();
    //游戏设置
    public static GameSet gameSet = new GameSet();
    //装备合成分解
    public static Equipment equipment = new Equipment();
    //好友
    public static Friend friend = new Friend();
    //商店买卖仓库
    public static Store store = new Store();
    //属性
    public static Property property = new Property();
    //快捷引导
    public static QuickOption quickOption = new QuickOption();
    //查看其他玩家时用
    public Goods equipGoods;
    private String[] sEquipPlaceName = null;
    //技能CD持续时间条
    public Image imgContinueBar;
    //快捷键画笔
    public Graphics quickSetG;
    //小地图画笔
    public Graphics smallMapG;
    private int quickSetCount;
    public Image[] otherPlayerFlag;
    public boolean bRoamUIInit = false; //漫游界面下的资源是否已经初始化了
    public byte byWeatherType = -1; //天气的类型
    public byte byPopUpState = 0;
    //#if NOKIA_S60V5
     public byte byShowPointPlace = -1;
     public int iPointX = -1;
     public int iPointY = -1;
    //#endif
    public static int iScreenOffsetH = 0;

    /**
     * 设置游戏UI状态
     * @param state
     */
    public void setGameUiState(byte state) {
        byUiState = state;
    }

    /*
     * 设置下一个ui界面
     */
    public void setGameNextState(byte state) {
        byNextState = state;
    }

    /**
     * 获取游戏状态
     * @param state
     */
    public byte getGameUiState() {
        return byUiState;
    }
    /**
     * loading 条
     */
    private boolean m_bStart = false;

    public void initLoading() {
        MainCanvas.clearInput();
        byUiState = 0;
        bUiKeyPressLock = false;
        tips = this.sysMessage.readTXT(Constant.RES_TIPS_TXT, '|', Math.abs(new Random().nextInt() % 48) + 1, (short) 1024);
        this.iArray = new int[]{0, 0, 0};
        this.sArray = new String[]{"%", "读取中…"};
        try {
            //图片资源
            this.imgUiArray = new Image[5];
            //ui图片
            this.imgUiArray[0] = Tools.makeTransparent(Constant.DRAW_WIDTH, 20, 0x50, 0x000000);
            //#if NOKIAN73 || NOKIA_S40V3  || NORMAL_240_400 || MOT0 || K790
            //#else
//            this.imgUiArray[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);
            this.imgUiArray[2] = Tools.createPicFromGrayscale(ResManager.createImage(90000046), 0xFFFFFF);
            //#endif
            this.imgUiArray[3] = ResManager.createImage(90000047);
            this.imgUiArray[4] = ResManager.createImage(90000026);
            loadingAni = new int[5];
            ResManager.loadAnimation(Constant.RES_LOAD_ANI_PATH, Constant.RES_PUBLIC_TEMP, false);
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
//            System.out.print("loading界面载入图片异常");
        }
        iArray[2] = byMaxLoadingNum;
        lSystemTimeRecord = System.currentTimeMillis();
        m_bStart = true;
    }
    /**
     * 更新loading条
     */
    private long lSystemTimeRecord;

    public void updateLoading() {
        if (!m_bStart) {
            return;
        }
        if (iArray[0] > 6) {
            this.bFlag = this.bFlag ? false : true;
            iArray[0] = 0;
        } else {
            this.iArray[0]++;
        }
        if (iArray[1] == 40) {
            sArray[1] = "正在加载角色信息…";
        } else if (iArray[1] == 60) {
            sArray[1] = "正在加载地图信息…";
        } else if (iArray[1] == 80) {
            sArray[1] = "正在加载地图数据…";
        } else if (iArray[1] == 85) {
            sArray[1] = "正在加载图片资源…";
        }
        if (this.byMaxLoadingNum > 100) {
            this.byMaxLoadingNum = 100;
        }
        //#if NOKIA_S60V5
         if (NetManager.blLoginNetV5) {
             if (this.iArray[1] == 25) {
                 NetManager.blLoginNetV5 = false;
                 NetManager.getNewInstance().startNetManager();
             }
         }
        //#else
        //#endif 
        if (NetManager.blNetLogin) {
            if (this.iArray[1] >= 89) {
//                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_SOCKET_START, Constant.SOCKET_MSG_TYPE_LOGIC);
                // MainLogic.getInstance().send(Constant.MSG_NET_CMD_LOGIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                NetManager.blNetLogin = false;
            }
        }
        if (this.iArray[1] < 100) {
            if (this.iArray[1] < this.byMaxLoadingNum) {
                this.iArray[1]++;
            }
        } else {
//            MainCanvas.again_connection = false;
            if (this.byNextState == Constant.GAME_UI_ROAM) {
//                MainLogic.blLogined = true;
            }
            MainLogic.getInstance().pushState(this.byNextState, true);

        }
        MainCanvas.clearInput();
    }

    /**
     * 绘制loading条
     */
    public void drawLoading(Graphics g) {
        if (!m_bStart) {
            return;
        }
        if (imgUiArray[0] != null) {
            Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT, this.imgUiArray[0], 0, 0, Constant.DRAW_WIDTH, 20, Constant.TRANS_NONE);
        }
        //#if NOKIAN73 || NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
        //#else
        //绘制光柱
//        Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, imgUiArray[1]);
        g.drawImage(this.imgUiArray[2], Constant.UI_START_X + (Constant.DRAW_WIDTH >> 1) - this.imgUiArray[2].getWidth(), Constant.UI_START_Y, 0);
        g.drawRegion(this.imgUiArray[2], 0, 0, this.imgUiArray[2].getWidth(), this.imgUiArray[2].getHeight(), Constant.TRANS_MIRROR, Constant.UI_START_X + (Constant.DRAW_WIDTH >> 1), Constant.UI_START_Y, 0);
        //#endif
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH >> 1);
        startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT >> 1);
        ResManager.drawAnimation(ResManager.getAnimation(Constant.RES_LOAD_ANI_PATH, Constant.RES_PUBLIC_TEMP), loadingAni, g, startX, startY, true);
        g.drawImage(MainView.imgShadow, startX - (MainView.imgShadow.getWidth() >> 1), startY - (MainView.imgShadow.getHeight() >> 1), 0);
        startY += (MainView.imgShadow.getHeight() >> 1) + 2;
        if (bFlag) {
            if (byNextState == Constant.GAME_UI_CREATE_ROLE) {
                g.drawImage(imgUiArray[4], startX - (imgUiArray[4].getWidth() >> 1), startY, 0);
            } else {
                g.drawString(sArray[1], startX - (Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1), startY, 0);
            }
        }
        startY += Constant.FONT_SMALL_HEIGHT;
        if (imgUiArray[3] != null) {
            Tools.drawNumPic(g, imgUiArray[3], String.valueOf(this.iArray[1]) + sArray[0], (byte) 1, startX - (((String.valueOf(iArray[1]) + sArray[0]).length() * 5) >> 1), startY, (byte) 2);
        }
        startY += Constant.FONT_SMALL_HEIGHT;
        Tools.drawParagraph(g, Constant.UI_START_X + 20, startY, Constant.DRAW_WIDTH - 40, tips, 0x000000, Constant.FONT_SMALL_HEIGHT + 5, -1);
    }

    /**
     * 清除loading的资源
     */
    public void clearLoading() {
        this.imgUiArray = null;
        this.byNextState = 0;
        this.iArray = null;
        this.loadingAni = null;
        tips = null;
        this.sArray = null;
    }
    /**
     * 初始化漫游界面下的UI图片内容
     */
    private boolean bInBattlefield = false;
    //#if NOKIA_S40V3 || NOKIAN73 || NORMAL_240_400 || MOTO || K790
//#     private Image imgQuickBuff = null;
//#     private Graphics qiuckGraphics = null;
//#     private int iDrawIndex = 0;
    //#else
    //#endif

    public void initRoamUI() {
        //#if NOKIA_S60V5
         this.byShowPointPlace = -1;
        //#endif
        sIntegral = "战场积分：";
        quickSetCount = 0;
        if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
            otherPlayerFlag = new Image[2];
            otherPlayerFlag[0] = ResManager.createImage(90000078);
            otherPlayerFlag[1] = ResManager.createImage(90000079);
        } else {
            otherPlayerFlag = null;
        }
        bInBattlefield = sRoamMapKeys.equals("10101") ? true : false;
        //#if NOKIA_S60V5
         roamImgUiArray = new Image[23];
        //#else
//#        this.roamImgUiArray = new Image[17];
        //#endif
        //#if NOKIA_S40V3 || NOKIAN73  || NORMAL_240_400 || MOTO || K790
//#         imgQuickBuff = Image.createImage(225, 25);
//#         qiuckGraphics = imgQuickBuff.getGraphics();
        //#else
        //#endif
        try {
            //头像
            this.roamImgUiArray[0] = ResManager.createImage(1564);//女刺客
            this.roamImgUiArray[1] = ResManager.createImage(1563);//男刺客
            this.roamImgUiArray[2] = ResManager.createImage(1566);//女术士
            this.roamImgUiArray[3] = ResManager.createImage(1565);//男术士
            this.roamImgUiArray[4] = ResManager.createImage(1568);//女武师
            this.roamImgUiArray[5] = ResManager.createImage(1567);//男武师
            this.roamImgUiArray[6] = ResManager.createImage(1425);//怪物
            this.roamImgUiArray[7] = ResManager.createImage(90000036); //邮件提示
            //#if NOKIA_S60V5
             roamImgUiArray[8] = ResManager.createImage(90000089);//鼠标
            //#else
//#            this.roamImgUiArray[8] = Tools.makeTransparent(20, 24, 127, 0x87888D);//快捷键背景
            //#endif
            this.roamImgUiArray[9] = ResManager.createImage(90000049);//星星图片（怪物等级）
            //数字图片
            this.roamImgUiArray[10] = Tools.makeTransparent(ResManager.createImage(90000062), 0xff);

            //#if NOKIA_S40V3 || NOKIAN73 || NORMAL_240_400 || MOTO || K790
            //#else
            this.roamImgUiArray[11] = Tools.createPicFromGrayscale(ResManager.createImage(90000030), -1);//小地图
            this.roamImgUiArray[13] = Tools.makeTransparent(78, Constant.FONT_SMALL_HEIGHT * 4 + 12, 130, 0x00000000);//聊天框背景
            //#endif
//            this.roamImgUiArray[14] = ResManager.createImage(90000041);
            this.roamImgUiArray[15] = ResManager.createImage(90000039);//小地图任务叹号
            this.roamImgUiArray[16] = ResManager.createImage(90000048);            //表情
            //#if NOKIA_S60V5
             roamImgUiArray[17] = Tools.makeTransparent(ResManager.createImage(90000087), -1);//头像（小地图、快捷栏）边框
             roamImgUiArray[20] = ResManager.createImage(90000084);//方向键
             roamImgUiArray[21] = ResManager.createImage(90000091);//经验条
             roamImgUiArray[22] = ResManager.createImage(90000092);//底部快捷栏
            //#endif
            this.iRoamPositionX = Constant.UI_START_X + 179;
            //游戏设置
            this.byWeatherType = -1;
            Rms.loadGame(Constant.RMS_GAME_DRAW_SET);
            MainLogic.uiEquipment.initchatSet();
            //#if NOKIAN73 || NOKIA_S40V3  || NORMAL_240_400 || MOTO || K790
            //#else
            if (MainLogic.uiEquipment.isopenset[18]) {
                this.byWeatherType = getScenceWeatherType(this.sRoamMapKeys);
                this.initWeather();
            }
            //#endif
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
            Tools.printLog(e.getMessage());
            Tools.printLog("漫游界面UI初始化异常");
        }
        if (sMarquee != null && sMarquee.length() > 0) {
            //#if NOKIA_S60V5
             iRoamPositionX = Constant.UI_START_X + 295 + 10;
            //#else
//#            iRoamPositionX = Constant.UI_START_X + 185 + 10;
            //#endif
        }
    }

    /**
     * 绘制漫游界面下的的ui内容
     */
    public void drawRoamUI(Graphics g) {
        //#if NOKIA_S60V5
         int iAvatarStartX = Constant.UI_START_X + 1;//玩家头像起始X
         int iAvatarStartY = Constant.UI_START_Y + 1;//玩家头像起始Y
         int iAvatarHeight = 31;//玩家头像高度
         int iBloodBoxHeight = 6;//血条高度
         int iMagicBoxHeight = 6;//蓝条高度
         int iBoxStartX = iAvatarStartX + 30;//玩家血条、蓝条起始X
         int iBloodBoxStartY = iAvatarStartY + 18;//玩家血条起始Y
         int iMagicBoxStartY = iBloodBoxStartY + iMagicBoxHeight;//玩家蓝条起始Y
         //绘制玩家头像
         if (MainLogic.getInstance().gamePlayer.byPlayerSex == Constant.PLAYER_SEX_WOMAN) {//性别为女
             if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_ASSASSIN) {//职业为：刺客
                 Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[0], iAvatarStartX, iAvatarStartY);
             } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_MASTER) {//职业为：术士
                 Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[2], iAvatarStartX, iAvatarStartY);
             } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_SWORD) {//职业为：武师
                 Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[4], iAvatarStartX, iAvatarStartY);
             }
         } else {
             if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_ASSASSIN) {//职业为：刺客
                 Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[1], iAvatarStartX, iAvatarStartY);
             } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_MASTER) {//职业为：术士
                 Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[3], iAvatarStartX, iAvatarStartY);
             } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_SWORD) {//职业为：武师
                 Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[5], iAvatarStartX, iAvatarStartY);
             }
         }
        //#else
//#        //绘制人物头像和血条蓝条
//#        //人物的头像,起始位置，其他的以此坐标为相对值
//#        int iAvatarStartX = Constant.UI_START_X + 3;
//#        int iAvatarStartY = Constant.UI_START_Y + 5;
//#        int iAvatarHeight = this.roamImgUiArray[0].getHeight();
//#        int iBloodBoxHeight = 4;
//#        int iMagicBoxHeight = 4;
//#        //血条和快捷键方框起始位置
//#        int iBoxStartX = iAvatarStartX + this.roamImgUiArray[0].getWidth() - 1;
//#        int iBloodBoxStartY = iAvatarStartY + roamImgUiArray[0].getHeight() - 1 - iBloodBoxHeight - iMagicBoxHeight;
//#        int iMagicBoxStartY = iBloodBoxStartY + iBloodBoxHeight;
//#        //玩家的头像
//#        if (MainLogic.getInstance().gamePlayer.byPlayerSex == Constant.PLAYER_SEX_WOMAN) {//性别为：女
//#            if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_ASSASSIN) {//职业为：刺客
//#                g.drawImage(this.roamImgUiArray[0], iAvatarStartX, iAvatarStartY, 0);
//#            } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_MASTER) {//职业为：术士
//#                g.drawImage(this.roamImgUiArray[2], iAvatarStartX, iAvatarStartY, 0);
//#            } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_SWORD) {//职业为：武师
//#                g.drawImage(this.roamImgUiArray[4], iAvatarStartX, iAvatarStartY, 0);
//#            }
//#        } else {
//#            if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_ASSASSIN) {//职业为：刺客
//#                g.drawImage(this.roamImgUiArray[1], iAvatarStartX, iAvatarStartY, 0);
//#            } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_MASTER) {//职业为：术士
//#                g.drawImage(this.roamImgUiArray[3], iAvatarStartX, iAvatarStartY, 0);
//#            } else if (MainLogic.getInstance().gamePlayer.iplayerOccupation == Constant.PLAYER_OCCUPTION_SWORD) {//职业为：武师
//#                g.drawImage(this.roamImgUiArray[5], iAvatarStartX, iAvatarStartY, 0);
//#            }
//#        }
        //#endif
        //显示人物等级人物等级
        Tools.drawNumPic(g, this.roamImgUiArray[10], String.valueOf(MainLogic.getInstance().gamePlayer.iPlayerLevel),
                (byte) 1, iAvatarStartX, iAvatarStartY + iAvatarHeight - 7, (byte) 1);
        //绘制战场积分
        if (bInBattlefield) {
            Tools.drawShadowString(g, (byte) 2, sIntegral + MainLogic.getInstance().gamePlayer.integral,
                    iAvatarStartX, iAvatarStartY + iAvatarHeight, 0x00CCFF, 0x000000);
        }
        //绘制邮件提示
        if (isReceiveEmail) {
            if (uichat_index % 5 < 3) {
                g.drawImage(this.roamImgUiArray[7], iAvatarStartX, iAvatarStartY, 0);
                Tools.drawNumPic(g, this.roamImgUiArray[10], String.valueOf(1), 1, 50, 5, 7, iAvatarStartX + ((this.roamImgUiArray[7].getWidth() - 5) >> 1), iAvatarStartY + ((this.roamImgUiArray[7].getHeight() - 7) >> 1), Graphics.TOP | Graphics.LEFT);
            }
        }
        //#if NOKIA_S60V5
         startX = Constant.UI_START_X + 0;
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - roamImgUiArray[22].getHeight();
         g.drawImage(roamImgUiArray[22], startX, startY, 0);
         //绘制方向键
         startX = Constant.UI_START_X + 2;
         startY -= 162;//每个方向键的高度为80
         Tools.drawS60V5Direction(g, roamImgUiArray[20], startX, startY);
         int w = 38 * 9 + 8;
         int h = 38;
         startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - h - 1;
         w = 38;
         int dest_y = 0;
         long lcurrentTime = System.currentTimeMillis();
 //        g.drawImage(roamImgUiArray[8], startX, startY + 7, 0);
         if (MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime != null && MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[0] != -1) {
             if ((lcurrentTime - MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[0]) >= MainLogic.getInstance().gamePlayer.iPlayerSkillCoolSpaceTime[0]) {
                 MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[0] = -1;
             }
         }
         for (int i = 0; i < 9; i++) {
 //            drawQuickSetRect(g, roamImgUiArray[17], roamImgUiArray[8], startX, startY);
             if (gameSet.QuickSet[i][0] != null) {
                 if (gameSet.QuickSet[i][1].equals("2")) {//物品
                     g.drawImage(gameSet.imgArrayQuickSetIcon[i], startX + (w - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1),
                             startY + (h - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), 0);
                     Tools.drawNumPic(g, this.roamImgUiArray[10], gameSet.QuickSet[i][6], (byte) 1,
                             startX + 6, startY + 6, (byte) 1);
                     if (gameSet.quickSetTime[i][0] != 0) {
                         if (lcurrentTime - gameSet.quickSetTime[i][0] >= gameSet.quickSetTime[i][1]) {
                             gameSet.quickSetTime[i][0] = 0;
                         } else {
                             if (imgContinueBar == null) {
                                 imgContinueBar = Tools.makeTransparent(w - 14, h - 14, 160, 0x038b93);
                             }
                             dest_y = (int) ((imgContinueBar.getHeight() * (lcurrentTime - gameSet.quickSetTime[i][0]) * 100
                                     / gameSet.quickSetTime[i][1] / 100));
                             if (dest_y >= 0) {
                                 g.setClip(startX + 7, startY + 7, w - 14, h - 14);
                                 g.drawImage(imgContinueBar, startX + 7, startY + 7 + dest_y, 0);
                                 g.setClip(Constant.UI_START_X, Constant.UI_START_Y, Constant.SCREEN_WIDTH, Constant.SCREEN_HEIGHT);
                             }
                         }
                     }
                 } else {
                     g.drawImage(gameSet.imgArrayQuickSetIcon[i], startX + (w - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1),
                             startY + (h - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), 0);
                     int index = MainLogic.getInstance().getQuickSetID(i);
                     //如果该技能在CD中
                     if (index != -1 && MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index] != -1) {
                         if ((lcurrentTime - MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index])
                                 >= MainLogic.getInstance().gamePlayer.iPlayerSkillCoolSpaceTime[index]) {
                             Tools.printLog("冷却完成");
                             MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index] = -1;
                         } else {
                             if (imgContinueBar == null) {
                                 imgContinueBar = Tools.makeTransparent(w - 14, h - 14, 160, 0x038b93);
                             }
                             dest_y = (int) ((imgContinueBar.getHeight()
                                     * (lcurrentTime - MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index])
                                     * 100 / MainLogic.getInstance().gamePlayer.iPlayerSkillCoolSpaceTime[index] / 100));
                             if (dest_y >= 0) {
                                 g.setClip(startX + 7, startY + 7, w - 14, h - 14);
                                 g.drawImage(imgContinueBar, startX + 7, startY + 7 + dest_y, 0);
                                 g.setClip(Constant.UI_START_X, Constant.UI_START_Y, Constant.SCREEN_WIDTH, Constant.SCREEN_HEIGHT);
                             }
                         }
                     }
                 }
             }
             g.drawRegion(this.roamImgUiArray[10], 55 + 5 * i, 0, 5, 7,
                     Constant.TRANS_NONE, startX + w - 7, startY + h - 7, 0);
             startX += (w + 1);
         }
        //#else
//#        int w = 225;
//#        int h = 25;
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
        //#if NOKIA_E72
//#         startY = Constant.SCREEN_HEIGHT - 30;
        //#else
//#        startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 30;
        //#endif
        //#if NOKIA_S40V3 || NOKIAN73 || NORMAL_240_400 || MOTO || K790
//#         if (iDrawIndex == 0 || iDrawIndex % 4 == 0) {
//#             drawQuick(qiuckGraphics, w, h, startX, startY);
//#         }
//#         iDrawIndex++;
//#         if (iDrawIndex > 2000) {
//#             iDrawIndex = 0;
//#         }
//#         g.drawImage(imgQuickBuff, startX, startY, 0);
        //#else
//#        drawQuick(g, w, h, startX, startY);
        //#endif
        //#endif
        //玩家的经验条
        if (MainLogic.getInstance().gamePlayer.iPlayerXP > MainLogic.getInstance().gamePlayer.iPlayerMaxXP) {
            MainLogic.getInstance().gamePlayer.iPlayerXP = MainLogic.getInstance().gamePlayer.iPlayerMaxXP;
        }
        //#if NOKIA_S60V5
         w = roamImgUiArray[21].getWidth();
         w = (int) (MainLogic.getInstance().gamePlayer.iPlayerXP * w / MainLogic.getInstance().gamePlayer.iPlayerMaxXP);
         startX = Constant.UI_START_X + 9;
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - roamImgUiArray[22].getHeight() + 38;
         g.drawRegion(roamImgUiArray[21], 0, 0, w, 5, Constant.TRANS_NONE, startX, startY, 0);
        //#else
//#        w = 225;
//#        h = 2;
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
        //#if NOKIA_E72
//#         startY = Constant.SCREEN_HEIGHT - 30 - h;
        //#else
//#        startY -= h;
        //#endif
//#
//#        g.setColor(0x000000);
//#        g.drawRect(startX, startY, w, h);
//#        g.setColor(0x87888D);
//#        g.fillRect(startX + 1, startY + 1, w - 1, h - 1);
//#
//#        Tools.drawBloodStrip(g, 0xffcc00, -1, (w - 1), MainLogic.getInstance().gamePlayer.iPlayerMaxXP,
//#                MainLogic.getInstance().gamePlayer.iPlayerXP, h - 1, startX + 1, startY + 1);
//#
        //#endif
        //玩家的血量和当前的血量
        if (MainLogic.getInstance().gamePlayer.iPlayerHP > MainLogic.getInstance().gamePlayer.iPlayerMaxHP) {
            MainLogic.getInstance().gamePlayer.iPlayerHP = MainLogic.getInstance().gamePlayer.iPlayerMaxHP;
        }
        //血条图片
        w = (Constant.DRAW_WIDTH >> 2) + 10;
        g.setColor(0x87888D);
        g.fillRect(iBoxStartX + 1, iBloodBoxStartY + 1, w - 1, (iBloodBoxHeight << 1) - 1);
        g.setColor(0x000000);
        g.drawRect(iBoxStartX, iBloodBoxStartY, w, iBloodBoxHeight);
        g.drawRect(iBoxStartX, iMagicBoxStartY, w, iMagicBoxHeight);
        Tools.drawBloodStrip(g, 0xFF0000, -1, (w - 1), MainLogic.getInstance().gamePlayer.iPlayerMaxHP,
                MainLogic.getInstance().gamePlayer.iPlayerHP, iBloodBoxHeight - 1, iBoxStartX + 1, iBloodBoxStartY + 1);
        //玩家魔法量和当前的魔法值
        if (MainLogic.getInstance().gamePlayer.iPlayerMP > MainLogic.getInstance().gamePlayer.iPlayerMaxMP) {
            MainLogic.getInstance().gamePlayer.iPlayerMP = MainLogic.getInstance().gamePlayer.iPlayerMaxMP;
        }
        //魔法条图片
        Tools.drawBloodStrip(g, 0x00D7FF, -1, (w - 1), MainLogic.getInstance().gamePlayer.iPlayerMaxMP,
                MainLogic.getInstance().gamePlayer.iPlayerMP, iMagicBoxHeight - 1, iBoxStartX + 1,
                iMagicBoxStartY + 1);
        //#if NOKIA_S60V5
         //绘制buffer
         SkillBuffManager.drawBuff(g, MainLogic.getInstance().gamePlayer.lPlayerID, iBoxStartX + 1, iBloodBoxStartY - 9);
         //绘制小地图的地形
         int iMapStartX = Constant.UI_START_X + Constant.DRAW_WIDTH - 55;
         if (MainLogic.getInstance().uiEquipment.isopenset[4]) {
             g.setClip(iMapStartX + 1, Constant.UI_START_Y + 8, 48, 48);
             drawSmap(g);
 //            g.setClip(iMapStartX, Constant.UI_START_Y + 7, 50, 50);
 //            //绘制小地图的遮罩
 //            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_NONE, iMapStartX, Constant.UI_START_Y + 5, 0);
 //            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_MIRROR, iMapStartX + 25, Constant.UI_START_Y + 5, 0);
 //            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_MIRROR_ROT180, iMapStartX, Constant.UI_START_Y + 5 + 25, 0);
 //            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_ROT180, iMapStartX + 25, Constant.UI_START_Y + 5 + 25, 0);
             g.setClip(iMapStartX + 1, Constant.UI_START_Y + 8, 48, 48);
             //绘制小地图人物坐标
             drawPlayerCoordinates(g);
             g.setClip(0, 0, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
 //            g.setColor(0x0D1214);
 //            g.drawRect(iMapStartX, Constant.UI_START_Y + 7, 50, 50);
         }
         //绘制地图名字
         //阴影文字
         int strStart_y = 67;
 //        Tools.drawShadowString(g, (byte) 2, sRoamMapName, iMapStartX + ((56 - Constant.FONT_SMALL.stringWidth(sRoamMapName) >> 1)), Constant.UI_START_Y + 55, 0xc3c3c3, 0x000000);
         Tools.drawShadowString(g, (byte) 2, sRoamMapName, Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(sRoamMapName) - 2,
                 Constant.UI_START_Y + iAvatarStartY + strStart_y, 0x505050, 0x000000);
         //绘制主角坐标数字
         Tools.drawNumPic(g, this.roamImgUiArray[10], String.valueOf(MainLogic.getInstance().gamePlayer.iPlayerX), 0, 50,
                 5, 7, iMapStartX + 23, Constant.UI_START_Y + iAvatarStartY + strStart_y + Constant.FONT_SMALL_HEIGHT, Graphics.TOP | Graphics.RIGHT);
         g.drawRegion(this.roamImgUiArray[10], 100, 0, 5, 7, Constant.TRANS_NONE,
                 iMapStartX + 23, Constant.UI_START_Y + iAvatarStartY + strStart_y + Constant.FONT_SMALL_HEIGHT, 0);
         Tools.drawNumPic(g, this.roamImgUiArray[10], String.valueOf(MainLogic.getInstance().gamePlayer.iPlayerY), 0, 50,
                 5, 7, iMapStartX + 28, Constant.UI_START_Y + iAvatarStartY + strStart_y + Constant.FONT_SMALL_HEIGHT, Graphics.TOP | Graphics.LEFT);
         drawSmapRect(g, roamImgUiArray[17], Constant.UI_START_X + Constant.DRAW_WIDTH - 61, iAvatarStartY);
        //#else
//#        //绘制buffer
//#        SkillBuffManager.drawBuff(g, MainLogic.getInstance().gamePlayer.lPlayerID, iBoxStartX + 1, iAvatarStartY + 1);
//#        //绘制小地图的地形
//#        int iMapStartX = Constant.UI_START_X + Constant.DRAW_WIDTH - 55;
//#        if (MainLogic.getInstance().uiEquipment.isopenset[4]) {
//#            g.setClip(iMapStartX + 1, Constant.UI_START_Y + 8, 48, 48);
//#            drawSmap(g);
//#            g.setClip(iMapStartX, Constant.UI_START_Y + 7, 50, 50);
//#            //绘制小地图的遮罩
            //#if NOKIA_S40V3 || MOTO || K790
            //#else
//#            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_NONE, iMapStartX, Constant.UI_START_Y + 5, 0);
//#            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_MIRROR, iMapStartX + 25, Constant.UI_START_Y + 5, 0);
//#            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_MIRROR_ROT180, iMapStartX, Constant.UI_START_Y + 5 + 25, 0);
//#            g.drawRegion(this.roamImgUiArray[11], 33, 35, 25, 25, Constant.TRANS_ROT180, iMapStartX + 25, Constant.UI_START_Y + 5 + 25, 0);
            //#endif
//#            //绘制小地图人物坐标
//#            drawPlayerCoordinates(g);
//#            g.setClip(0, 0, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
//#            g.setColor(0x0D1214);
//#            g.drawRect(iMapStartX, Constant.UI_START_Y + 7, 50, 50);
//#        }
//#        //绘制地图名字
//#        //阴影文字
//#        int strStart_y = 58;
//#//        Tools.drawShadowString(g, (byte) 2, sRoamMapName, iMapStartX + ((56 - Constant.FONT_SMALL.stringWidth(sRoamMapName) >> 1)), Constant.UI_START_Y + 55, 0xc3c3c3, 0x000000);
//#        Tools.drawShadowString(g, (byte) 2, sRoamMapName, Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(sRoamMapName) - 2,
//#                Constant.UI_START_Y + strStart_y, 0xc3c3c3, 0x000000);
//#        //绘制主角坐标数字
//#        Tools.drawNumPic(g, this.roamImgUiArray[10], String.valueOf(MainLogic.getInstance().gamePlayer.iPlayerX), 0, 50,
//#                5, 7, iMapStartX + 23, Constant.UI_START_Y + strStart_y + Constant.FONT_SMALL_HEIGHT, Graphics.TOP | Graphics.RIGHT);
//#        g.drawRegion(this.roamImgUiArray[10], 100, 0, 5, 7, Constant.TRANS_NONE,
//#                iMapStartX + 23, Constant.UI_START_Y + strStart_y + Constant.FONT_SMALL_HEIGHT, 0);
//#        Tools.drawNumPic(g, this.roamImgUiArray[10], String.valueOf(MainLogic.getInstance().gamePlayer.iPlayerY), 0, 50,
//#                5, 7, iMapStartX + 28, Constant.UI_START_Y + strStart_y + Constant.FONT_SMALL_HEIGHT, Graphics.TOP | Graphics.LEFT);
        //#endif
        ////////////////////////////////////////////
        if (MainLogic.getInstance().iLockedObjNumber[0][0] > - 1) {
            int otherAvatarStartX = iBoxStartX + (w);
            //#if NOKIA_S60V5
             int otherBloodBoxStartX = otherAvatarStartX + 30;
            //#else
//#            //血条起始位置
//#            int otherBloodBoxStartX = otherAvatarStartX + this.roamImgUiArray[0].getWidth() - 1;
            //#endif
            if (MainLogic.getInstance().iLockedObjNumber[0][4] == Constant.LOCKED_TYPE_NPC) {//锁定的是NPC
                if (this.roamImgUiArray[6] != null) {
                    //#if NOKIA_S60V5
                     Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[6], otherAvatarStartX, iAvatarStartY);
                    //#else
//#                    g.drawImage(this.roamImgUiArray[6], otherAvatarStartX, iAvatarStartY, 0);
                    //#endif
                }
            } else if (MainLogic.getInstance().iLockedObjNumber[0][4] == Constant.LOCKED_TYPE_OTHERPLAYER) {//锁定的是其他玩家
                if (MainLogic.getInstance().bLockedSex == Constant.PLAYER_SEX_WOMAN) {//性别为：女
                    if (MainLogic.getInstance().bLockedDuty == Constant.PLAYER_OCCUPTION_ASSASSIN) {//职业为：刺客
                        //#if NOKIA_S60V5
                         Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[0], otherAvatarStartX, iAvatarStartY);
                        //#else
//#                        g.drawImage(this.roamImgUiArray[0], otherAvatarStartX, iAvatarStartY, 0);
                        //#endif
                    } else if (MainLogic.getInstance().bLockedDuty == Constant.PLAYER_OCCUPTION_MASTER) {//职业为：术士
                        //#if NOKIA_S60V5
                         Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[2], otherAvatarStartX, iAvatarStartY);
                        //#else
//#                        g.drawImage(this.roamImgUiArray[2], otherAvatarStartX, iAvatarStartY, 0);
                        //#endif
                    } else if (MainLogic.getInstance().bLockedDuty == Constant.PLAYER_OCCUPTION_SWORD) {//职业为：武师
                        //#if NOKIA_S60V5
                         Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[4], otherAvatarStartX, iAvatarStartY);
                        //#else
//#                        g.drawImage(this.roamImgUiArray[4], otherAvatarStartX, iAvatarStartY, 0);
                        //#endif
                    }
                } else {
                    if (MainLogic.getInstance().bLockedDuty == Constant.PLAYER_OCCUPTION_ASSASSIN) {//职业为：刺客
                        //#if NOKIA_S60V5
                         Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[1], otherAvatarStartX, iAvatarStartY);
                        //#else
//#                        g.drawImage(this.roamImgUiArray[1], otherAvatarStartX, iAvatarStartY, 0);
                        //#endif
                    } else if (MainLogic.getInstance().bLockedDuty == Constant.PLAYER_OCCUPTION_MASTER) {//职业为：术士
                        //#if NOKIA_S60V5
                         Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[3], otherAvatarStartX, iAvatarStartY);
                        //#else
//#                        g.drawImage(this.roamImgUiArray[3], otherAvatarStartX, iAvatarStartY, 0);
                        //#endif
                    } else if (MainLogic.getInstance().bLockedDuty == Constant.PLAYER_OCCUPTION_SWORD) {//职业为：武师
                        //#if NOKIA_S60V5
                         Tools.drawHead(g, roamImgUiArray[17], roamImgUiArray[5], otherAvatarStartX, iAvatarStartY);
                        //#else
//#                        g.drawImage(this.roamImgUiArray[5], otherAvatarStartX, iAvatarStartY, 0);
                        //#endif
                    }
                }
            }
            if (MainLogic.getInstance().iLockedObjNumber[0][4] == Constant.LOCKED_TYPE_OTHERPLAYER
                    || MainLogic.getInstance().gameNpcArray.shNpcTypes[(int) MainLogic.getInstance().iLockedObjNumber[0][1]]
                    == Constant.NPC_TYPE_CANATTACK) {//其他玩家或者是可攻击的NPC（即怪）
                w = (Constant.DRAW_WIDTH >> 2) - 5;
                g.setColor(0x87888D);
                g.fillRect(otherBloodBoxStartX + 1, iBloodBoxStartY + 1, w - 1, (iBloodBoxHeight << 1) - 1);
                g.setColor(0x000000);
                g.drawRect(otherBloodBoxStartX, iBloodBoxStartY, w, iBloodBoxHeight);
                g.drawRect(otherBloodBoxStartX, iMagicBoxStartY, w, iMagicBoxHeight);
                //显示人物等级
                if (MainLogic.iLockedObjInfor != null) {
                    Tools.drawNumPic(g, roamImgUiArray[10], String.valueOf(MainLogic.iLockedObjInfor[0]),
                            (byte) 1, otherAvatarStartX, iAvatarStartY + iAvatarHeight - 7, (byte) 1);
                    //绘制buffer
                    if (GameBean.L_PLAYER_ID == MainLogic.getInstance().lLockedId) {
                        //#if NOKIA_S60V5
                         SkillBuffManager.drawBuff(g, GameBean.L_PLAYER_ID, otherBloodBoxStartX + 1, iBloodBoxStartY - 9);
                        //#else
//#                        SkillBuffManager.drawBuff(g, GameBean.L_PLAYER_ID, otherBloodBoxStartX + 1, iAvatarStartY + 1);
                        //#endif
                    }
                    //玩家的血量和当前的血量
                    if (MainLogic.iLockedObjInfor[2] > MainLogic.iLockedObjInfor[1]) {
                        MainLogic.iLockedObjInfor[2] = MainLogic.iLockedObjInfor[1];
                    }
                    //血条图片
                    Tools.drawBloodStrip(g, 0xFF0000, -1, (w - 1), MainLogic.iLockedObjInfor[1],
                            MainLogic.iLockedObjInfor[2], iBloodBoxHeight - 1, otherBloodBoxStartX + 1, iBloodBoxStartY + 1);
                    if (MainLogic.getInstance().iLockedObjNumber[0][4] == Constant.LOCKED_TYPE_OTHERPLAYER) {
                        //玩家的魔法量和当前的魔法量
                        if (MainLogic.iLockedObjInfor[4] > MainLogic.iLockedObjInfor[3]) {
                            MainLogic.iLockedObjInfor[4] = MainLogic.iLockedObjInfor[3];
                        }
                        //魔法条图片
                        Tools.drawBloodStrip(g, 0x00D7FF, -1, (w - 1), MainLogic.iLockedObjInfor[3],
                                MainLogic.iLockedObjInfor[4], iMagicBoxHeight - 1, otherBloodBoxStartX + 1, iMagicBoxStartY + 1);
                    } else {
                        Tools.drawBloodStrip(g, 0x00D7FF, -1, (w - 1), w - 1, w - 1,
                                iMagicBoxHeight - 1, otherBloodBoxStartX + 1, iMagicBoxStartY + 1);
                    }
                    if (MainLogic.getInstance().iLockedObjNumber[0][4] == Constant.LOCKED_TYPE_NPC
                            && MainLogic.getInstance().gameNpcArray.shNpcTypes[(int) MainLogic.getInstance().iLockedObjNumber[0][1]]
                            == Constant.NPC_TYPE_CANATTACK) {//锁定的为可攻击的NPC（即怪物），画怪物等级
                        for (int i = 0; i < MainLogic.getInstance().bLockedDifficulty; i++) {
                            g.drawImage(this.roamImgUiArray[9], otherBloodBoxStartX + 12 * i, iMagicBoxStartY, 0);
                        }
                    }
                } else {
                    Tools.drawBloodStrip(g, 0xFF0000, -1, (w - 1), w - 1, w - 1, iBloodBoxHeight - 1,
                            otherBloodBoxStartX + 1, iBloodBoxStartY + 1);
                    Tools.drawBloodStrip(g, 0x00D7FF, -1, (w - 1), w - 1, w - 1,
                            iMagicBoxHeight - 1, otherBloodBoxStartX + 1, iMagicBoxStartY + 1);
                }
            }
        }
        //
        if (uiSyschat_index <= uiChatTime + timeuiChat * uiSyschatTime_num) {
            if (MainLogic.getInstance().uiEquipment.isopenset[5]) {
                try {
                    drawRoamSysUIChat(g);
                } catch (Exception e) {
                }
            }
            if (uiSyschat_index % timeuiChat == 3) {
                uiSyschatTime_index++;
                if (uiSyschatTime_index > uiSyschatTime_num) {
                    uiSyschatTime_index = uiSyschatTime_num;
                }
            }
        } else if (uiSyschat_index == uiChatTime + timeuiChat * uiSyschatTime_num + 5) {
            uiSyschatStrArray = new String[1][4];
            uiSyschatTime_num = 0;
            uiSyschatTime_index = -1;
//            System.out.println("清理2  ");
        }

        uiSyschat_index++;
//        
///
        if (uichat_index <= uiChatTime + timeuiChat * uichatTime_num) {
            if (MainLogic.getInstance().uiEquipment.isopenset[5]) {
                try {
                    drawRoamUIChat(g);
                } catch (Exception e) {
                }
            }
        } else if (uichat_index == uiChatTime + timeuiChat * uichatTime_num + 5) {
            uichatStrArray = new String[1][4];
            uichatTime_num = 0;
            uichatTime_index = -1;
            isuichat_clear = false;
            isuichat_index = 0;
            uichat_index = 100;
            uichatline_num = 0;
//            System.out.println("清理  ");

        }
        uichat_index++;
        //#if NOKIA_S60V5
         //跑马灯
         startY = iAvatarStartY + 33;
         if (sMarquee != null && sMarquee.length() > 0) {
             startX = Constant.UI_START_X + 0;
             w = 295;
             Tools.drawMarquee(g, sMarquee, startX, iRoamPositionX, startY, w, 0xefff00, blackColor);
         }
        //#else
//#        //跑马灯
//#        startY = iAvatarStartY + 23;
//#        if (sMarquee != null && sMarquee.length() > 0) {
//#            startX = Constant.UI_START_X + 0;
//#            w = 185;
//#            Tools.drawMarquee(g, sMarquee, startX, iRoamPositionX, startY, w, 0xefff00, blackColor);
//#        }
        //#endif
        //组队
        team.drawTeam(g, iAvatarStartX, startY + Constant.FONT_SMALL_HEIGHT + 3, this.roamImgUiArray[10]);
        quickOption.drawBox(g);
        quickOption.drawQuickNote(g);
    }
//#if NOKIA_S60V5
 
     public void drawRoamPoint(Graphics g) {
         switch (this.byShowPointPlace) {
             case 1:
                 g.drawRegion(this.roamImgUiArray[8], 0, 0, 19, 23, Constant.TRANS_NONE, this.iPointX - 9 - MainLogic.gameMap.iMapWorldOffsetX, this.iPointY - 23 - MainLogic.gameMap.iMapWorldOffsetY, 0);
                 break;
             case 2:
                 g.drawRegion(this.roamImgUiArray[8], 19, 0, 19, 23, Constant.TRANS_NONE, this.iPointX - 8 - MainLogic.gameMap.iMapWorldOffsetX, this.iPointY - 21 - MainLogic.gameMap.iMapWorldOffsetY, 0);
                 break;
             case 3:
                 g.drawRegion(this.roamImgUiArray[8], 38, 0, 19, 23, Constant.TRANS_NONE, this.iPointX - 7 - MainLogic.gameMap.iMapWorldOffsetX, this.iPointY - 19 - MainLogic.gameMap.iMapWorldOffsetY, 0);
                 break;
 
         }
     }
 
     public void clearPoint() {
         this.byShowPointPlace = -1;
         this.iPointX = -1;
         this.iPointY = -1;
     }
 
     public void startAutoRunPoint(int iStartX, int iStartY) {
         this.byShowPointPlace = 1;
         this.iPointX = iStartX;
         this.iPointY = iStartY;
 
     }
//#endif
    /*
     * 绘制快捷栏
     */

    public void drawQuick(Graphics g, int w, int h, int startX, int startY) {
        int dest_y = 0;
        long lcurrentTime = 0;
        //#if NOKIA_S40V3 || NOKIA_S60V5|| NOKIAN73 || NORMAL_240_400 || MOTO || K790
         startX = 0;
         startY = 0;
         g.setColor(0x858585);
         g.fillRect(1, 1, w, h);
         g.setColor(0x000000);
         g.drawRect(0, 0, w, h);
        //#else
//#        g.setColor(0x000000);
//#        g.drawRect(startX, startY, w, h);
//#        Tools.drawTilePic(g, (byte) 1, startX + 1, startY + 1, w, roamImgUiArray[8], 0, 0, 20, 24, Constant.TRANS_NONE);
        //#endif
        w = 25;
        g.setColor(0x000000);

        lcurrentTime = System.currentTimeMillis();
        if (MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime != null && MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[0] != -1) {
            if ((lcurrentTime - MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[0]) >= MainLogic.getInstance().gamePlayer.iPlayerSkillCoolSpaceTime[0]) {
                MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[0] = -1;
            }
        }

        for (int i = 0; i < 9; i++) {
            if (gameSet.QuickSet[i][0] != null) {
                if (gameSet.QuickSet[i][1].equals("2")) {//物品
                    g.drawImage(gameSet.imgArrayQuickSetIcon[i], startX + 1 + i * w + (w - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1),
                            startY + 1 + (h - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), 0);
                    Tools.drawNumPic(g, this.roamImgUiArray[10], gameSet.QuickSet[i][6], (byte) 1,
                            startX + 3 + i * w + (w - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1),
                            startY + 3 + (h - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), (byte) 1);
                    if (gameSet.quickSetTime[i][0] != 0) {
                        if (lcurrentTime - gameSet.quickSetTime[i][0] >= gameSet.quickSetTime[i][1]) {
                            gameSet.quickSetTime[i][0] = 0;
                        } else {
                            if (imgContinueBar == null) {
                                imgContinueBar = Tools.makeTransparent(w, w, 160, 0x038b93);
                            }
                            dest_y = (int) ((w * (lcurrentTime - gameSet.quickSetTime[i][0]) * 100 / gameSet.quickSetTime[i][1] / 100));
                            if (dest_y >= 0) {
                                g.setClip(startX + 1 + i * w, startY, w, h);
                                g.drawImage(imgContinueBar, startX + 1 + i * w, startY + dest_y, 0);
                                g.setClip(Constant.UI_START_X, Constant.UI_START_Y, Constant.SCREEN_WIDTH, Constant.SCREEN_HEIGHT);
                            }
                        }
                    }
                } else {
                    g.drawImage(gameSet.imgArrayQuickSetIcon[i], startX + 1 + i * w + (w - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1),
                            startY + 1 + (h - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), 0);
                    int index = MainLogic.getInstance().getQuickSetID(i);
                    //如果该技能在CD中
                    if (MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime != null && index != -1 && MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index] != -1) {
                        if ((lcurrentTime - MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index]) >= MainLogic.getInstance().gamePlayer.iPlayerSkillCoolSpaceTime[index]) {
                            Tools.printLog("冷却完成");
                            MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index] = -1;
                        } else {
                            if (imgContinueBar == null) {
                                imgContinueBar = Tools.makeTransparent(w, w, 160, 0x038b93);
                            }
                            dest_y = (int) ((w * (lcurrentTime - MainLogic.getInstance().gamePlayer.iPlayerSkillStartTime[index]) * 100 / MainLogic.getInstance().gamePlayer.iPlayerSkillCoolSpaceTime[index] / 100));
                            if (dest_y >= 0) {
                                g.setClip(startX + 1 + i * w, startY, w, h);
                                g.drawImage(imgContinueBar, startX + 1 + i * w, startY + dest_y, 0);
                                g.setClip(Constant.UI_START_X, Constant.UI_START_Y, Constant.SCREEN_WIDTH, Constant.SCREEN_HEIGHT);
                            }
                        }
                    }
                }
            }
            g.drawRegion(this.roamImgUiArray[10], 55 + 5 * i, 0, 5, 7,
                    Constant.TRANS_NONE, startX + w - 4 + i * w, startY + h - 7 + 2, 0);
            g.drawLine(startX + (i + 1) * w, startY, startX + (i + 1) * w, startY + h);
        }
    }

    public void drawQuickSet(Graphics g) {
        for (int i = 0; i < 9; i++) {
            if (gameSet.QuickSet[i][0] != null) {
                if (gameSet.QuickSet[i][1].equals("2")) {//物品
                    g.drawImage(gameSet.imgArrayQuickSetIcon[i], Constant.UI_START_X + 1 + i * 25 + (25 - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1), Constant.UI_START_Y + 1 + (25 - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), 0);
                    Tools.drawNumPic(g, this.roamImgUiArray[10], gameSet.QuickSet[i][6], (byte) 1, Constant.UI_START_X + 3 + i * 25 + (25 - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1), Constant.UI_START_Y + 3 + (25 - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), (byte) 1);
                } else {
                    g.drawImage(gameSet.imgArrayQuickSetIcon[i], Constant.UI_START_X + 1 + i * 25 + (25 - gameSet.imgArrayQuickSetIcon[i].getWidth() >> 1), Constant.UI_START_Y + 1 + (25 - gameSet.imgArrayQuickSetIcon[i].getHeight() >> 1), 0);
                }
            }
            g.drawRegion(this.roamImgUiArray[10], 55 + 5 * i, 0, 5, 7, Constant.TRANS_NONE, Constant.UI_START_X + 21 + i * 25, Constant.UI_START_Y + 20, 0);
            g.drawLine(Constant.UI_START_X + (i + 1) * 25, Constant.UI_START_Y, Constant.UI_START_X + (i + 1) * 25, Constant.UI_START_Y + 25);
        }
    }

    public void drawQuickSetRect(Graphics g, Image rect, Image bg, int x, int y) {
        g.drawRegion(rect, 0, 0, 17, 17, Constant.TRANS_NONE, x, y, 0);
        g.drawRegion(rect, 22, 0, 21, 21, Constant.TRANS_NONE, x + 17, y, 0);
        g.drawRegion(rect, 0, 0, 17, 17, Constant.TRANS_ROT180, x + 21, y + 21, 0);
        g.drawRegion(rect, 22, 0, 21, 21, Constant.TRANS_ROT180, x, y + 17, 0);
//        g.drawImage(bg, x + 7, y + 7, 0);
    }

    public void drawSmapRect(Graphics g, Image rect, int x, int y) {
        g.drawRegion(rect, 0, 0, 17, 17, Constant.TRANS_NONE, x, y, 0);//左上角
        g.drawRegion(rect, 19, 0, 24, 24, Constant.TRANS_NONE, x + 39, y, 0);//右上角
        g.drawRegion(rect, 19, 0, 24, 24, Constant.TRANS_ROT180, x, y + 39, 0);//左下角
        g.drawRegion(rect, 0, 0, 17, 17, Constant.TRANS_ROT180, x + 46, y + 46, 0);//右下角
        Tools.drawTilePic(g, (byte) 1, x + 17, y, 22, rect, 0, 18, 7, 7, Constant.TRANS_NONE);//上面
        Tools.drawTilePic(g, (byte) 1, x + 24, y + 56, 22, rect, 0, 18, 7, 7, Constant.TRANS_ROT180);//下面
        Tools.drawTilePic(g, (byte) 2, x, y + 17, 22, rect, 0, 18, 7, 7, Constant.TRANS_ROT270);//左面
        Tools.drawTilePic(g, (byte) 2, x + 56, y + 24, 22, rect, 0, 18, 7, 7, Constant.TRANS_ROT90);//右面
    }
    /**
     * 绘制系统聊天
     */
    public String[][] uiSyschatStrArray = new String[1][4];//喊话类型,喊话内容,聊天中的任务或者物品的,名字，类型//0代表物品1代表任务
    public static int uiSyschatline_num;
    public static int uiSyschatTime_num;
    public static int uiSyschatTime_index = -1;
    public static int uiSyschat_index = 100;
//#if NOKIA_S60V5
 
     private void drawRoamSysUIChat(Graphics g) {
         int line = 0;
         if (uichatline_num > 0) {
             line = uichatline_num;
         }
         int start_y = Constant.DRAW_HEIGHT - 107 + 21;
         Tools.drawTilePic(g, (byte) 1, 164,
                 start_y - (Constant.FONT_SMALL_HEIGHT + 4) * (line + 1),
                 Constant.DRAW_WIDTH - 164, this.roamImgUiArray[13], 0, 0, 78, Constant.FONT_SMALL_HEIGHT * 1 + 4,
                 Constant.TRANS_NONE);
         int col = 0xffffff;
         if (uiSyschatStrArray[uiSyschatTime_index][0] != null) {
             switch (Integer.parseInt(uiSyschatStrArray[uiSyschatTime_index][0])) {
                 case 0://综合
                     col = 0xffffff;
                     break;
                 case 1://世界
                     col = 0xff7e00;
                     break;
                 case 2://当前
                     col = 0xffffff;
                     break;
                 case 3://队伍
                     col = 0x4eff00;
                     break;
                 case 4://帮派
                     col = 0x0000ff;
                     break;
                 case 5://系统
                     col = 0xefff00;
                     break;
                 case 6://私聊
                     col = 0xff00f0;
                     break;
             }
             Tools.drawShadowString(g, uiSyschatStrArray[uiSyschatTime_index][1],
                     Constant.UI_START_X + 164 + 1,
                     start_y - ((Constant.FONT_SMALL.getHeight() + 4) * (line + 1)) + 2,
                     col, 0x000000,
                     roamImgUiArray[16], 0, 0, 15, 16,
                     uiSyschatStrArray[uiSyschatTime_index][2],
                     uiSyschatStrArray[uiSyschatTime_index][3]);
 
         }
     }
    //#else
//#
//#    private void drawRoamSysUIChat(Graphics g) {
//#        //绘制遮罩层
//#        int line = 1;
//#        if (uichatline_num > 0) {
//#            line = uichatline_num + 1;
//#        }
        //#if NOKIA_S40V3 || NOKIAN73 || NORMAL_240_400 || MOTO || K790
//#         g.setColor(0x000000);
//#         g.fillRect(Constant.UI_START_X,
//#                 Constant.UI_START_Y + Constant.DRAW_HEIGHT - 17 - (Constant.FONT_SMALL_HEIGHT + 4) * (line + 1), Constant.DRAW_WIDTH, Constant.FONT_SMALL_HEIGHT * 1 + 4);
        //#else
//#
//#//        System.out.println("uichatline_num  " + uichatline_num);
//#        Tools.drawTilePic(g, (byte) 1, Constant.UI_START_X,
//#                Constant.UI_START_Y + Constant.DRAW_HEIGHT - 17 - (Constant.FONT_SMALL_HEIGHT + 4) * (line + 1),
//#                Constant.DRAW_WIDTH, this.roamImgUiArray[13], 0, 0, 78, Constant.FONT_SMALL_HEIGHT * 1 + 4,
//#                Constant.TRANS_NONE);
        //#endif
//#        int col = 0xffffff;
//#        if (uiSyschatStrArray[uiSyschatTime_index][0] != null) {
//#            switch (Integer.parseInt(uiSyschatStrArray[uiSyschatTime_index][0])) {
//#                case 0://综合
//#                    col = 0xffffff;
//#                    break;
//#                case 1://世界
//#                    col = 0xff7e00;
//#                    break;
//#                case 2://当前
//#                    col = 0xffffff;
//#                    break;
//#                case 3://队伍
//#                    col = 0x4eff00;
//#                    break;
//#                case 4://帮派
//#                    col = 0x0000ff;
//#                    break;
//#                case 5://系统
//#                    col = 0xefff00;
//#                    break;
//#                case 6://私聊
//#                    col = 0xff00f0;
//#                    break;
//#            }
//#            Tools.drawShadowString(g, uiSyschatStrArray[uiSyschatTime_index][1],
//#                    5, Constant.DRAW_HEIGHT - 17
//#                    - (Constant.FONT_SMALL.getHeight() + 4) * (line + 1) + 2,
//#                    col, 0x000000,
//#                    roamImgUiArray[16], 0, 0, 15, 16,
//#                    uiSyschatStrArray[uiSyschatTime_index][2],
//#                    uiSyschatStrArray[uiSyschatTime_index][3]);
//#        }
//#    }
    //#endif
    /**
     * 绘制对话
     */
    public final int uiChatTime = 60;
    public static int uichat_index = 100;
    public final int timeuiChat = 15;
    public boolean isuichat_clear;
    public static int isuichat_index;
    public static boolean isReceiveEmail;
    public String[][] uichatStrArray = new String[1][4];//喊话类型,喊话内容,聊天中的任务或者物品的,名字，类型//0代表物品1代表任务
    public static int uichatline_num;
    public static int uichatTime_num;
    public static int uichatTime_index = -1;
    //#if NOKIA_S60V5
     public final int UIchat_W = Constant.SCREEN_WIDTH - 175;
    //#endif
    //#if NOKIA_S60V5
 
     private void drawRoamUIChat(Graphics g) {
         //绘制遮罩层
         if (uichatline_num > 3) {
             uichatline_num = 3;
         }
         //drawTilePic(Graphics g, byte direction, int startX, int startY, int borderLength, Image srcImg, int imgStartX, int imgStartY, int imgWidth, int imgHeight, int transform)
         int start_y = Constant.DRAW_HEIGHT - 107 + 21;
         Tools.drawTilePic(g, (byte) 1, 164,
                 start_y - (Constant.FONT_SMALL_HEIGHT + 4) * uichatline_num,
                 Constant.DRAW_WIDTH - 164, this.roamImgUiArray[13], 0, 0, 78, (Constant.FONT_SMALL_HEIGHT + 4) * uichatline_num,
                 Constant.TRANS_NONE);
         int col = 0xffffff;
         if (uichatStrArray.length - 2 > 2) {
             for (int i = 0; i < 3; i++) {
                 if (uichatStrArray[i + uichatTime_index][0] != null) {
                     switch (Integer.parseInt(uichatStrArray[i + uichatTime_index][0])) {
                         case 0://综合
                             col = 0xffffff;
                             break;
                         case 1://世界
                             col = 0xff7e00;
                             break;
                         case 2://当前
                             col = 0xffffff;
                             break;
                         case 3://队伍
                             col = 0x4eff00;
                             break;
                         case 4://帮派
                             col = 0x0000ff;
                             break;
                         case 5://系统
                             col = 0xefff00;
                             break;
                         case 6://私聊
                             col = 0xff00f0;
                             break;
                     }
                     Tools.drawShadowString(g, uichatStrArray[i + uichatTime_index][1],
                             Constant.UI_START_X + 164 + 1,
                             start_y - ((Constant.FONT_SMALL.getHeight() + 4) * (3 - i)) + 2,
                             col, 0x000000,
                             roamImgUiArray[16], 0, 0, 15, 16,
                             uichatStrArray[i + uichatTime_index][2],
                             uichatStrArray[i + uichatTime_index][3]);
                 }
             }
         } else {
             for (int i = 0; i < uichatStrArray.length - 1; i++) {
                 if (uichatStrArray[i][0] != null) {
                     switch (Integer.parseInt(uichatStrArray[i][0])) {
                         case 0://综合
                             col = 0xffffff;
                             break;
                         case 1://世界
                             col = 0xff7e00;
                             break;
                         case 2://当前
                             col = 0xffffff;
                             break;
                         case 3://队伍
                             col = 0x4eff00;
                             break;
                         case 4://帮派
                             col = 0x0000ff;
                             break;
                         case 5://系统
                             col = 0xefff00;
                             break;
                         case 6://私聊
                             col = 0xff00f0;
                             break;
                     }
                     Tools.drawShadowString(g, uichatStrArray[i][1],
                             Constant.UI_START_X + 164 + 1,
                             start_y - ((Constant.FONT_SMALL.getHeight() + 4) * (uichatStrArray.length - 1 - i)) + 2,
                             col, 0x000000,
                             roamImgUiArray[16], 0, 0, 15, 16,
                             uichatStrArray[i][2],
                             uichatStrArray[i][3]);
                 }
             }
         }
 
     }
    //#else
//#
//#    private void drawRoamUIChat(Graphics g) {
//#        //绘制遮罩层
//#        if (uichatline_num > 3) {
//#            uichatline_num = 3;
//#        }
//#        //drawTilePic(Graphics g, byte direction, int startX, int startY, int borderLength, Image srcImg, int imgStartX, int imgStartY, int imgWidth, int imgHeight, int transform)
        //#if NOKIA_S40V3 || NOKIAN73 || NORMAL_240_400 || MOTO || K790
//#         g.setColor(0x000000);
//#         g.fillRect(Constant.UI_START_X,
//#                 Constant.UI_START_Y + Constant.DRAW_HEIGHT - 17 - (Constant.FONT_SMALL_HEIGHT + 4) * (uichatline_num + 1), Constant.DRAW_WIDTH, (Constant.FONT_SMALL_HEIGHT + 4) * uichatline_num);
        //#else
//#        Tools.drawTilePic(g, (byte) 1, Constant.UI_START_X,
//#                Constant.UI_START_Y + Constant.DRAW_HEIGHT - 17 - (Constant.FONT_SMALL_HEIGHT + 4) * (uichatline_num + 1),
//#                Constant.DRAW_WIDTH, this.roamImgUiArray[13], 0, 0, 78, (Constant.FONT_SMALL_HEIGHT + 4) * uichatline_num,
//#                Constant.TRANS_NONE);
//#
        //#endif
//#        int col = 0xffffff;
//#        if (uichatStrArray.length - 2 > 2) {
//#            for (int i = 0; i < 3; i++) {
//#                if (uichatStrArray[i + uichatTime_index][0] != null) {
//#                    switch (Integer.parseInt(uichatStrArray[i + uichatTime_index][0])) {
//#                        case 0://综合
//#                            col = 0xffffff;
//#                            break;
//#                        case 1://世界
//#                            col = 0xff7e00;
//#                            break;
//#                        case 2://当前
//#                            col = 0xffffff;
//#                            break;
//#                        case 3://队伍
//#                            col = 0x4eff00;
//#                            break;
//#                        case 4://帮派
//#                            col = 0x0000ff;
//#                            break;
//#                        case 5://系统
//#                            col = 0xefff00;
//#                            break;
//#                        case 6://私聊
//#                            col = 0xff00f0;
//#                            break;
//#                    }
//#                    Tools.drawShadowString(g, uichatStrArray[i + uichatTime_index][1],
//#                            Constant.UI_START_X + 5,
//#                            Constant.UI_START_Y + Constant.DRAW_HEIGHT - 17 - (Constant.FONT_SMALL_HEIGHT + 4) - ((Constant.FONT_SMALL.getHeight() + 4) * (3 - i)) + 2,
//#                            col, 0x000000,
//#                            roamImgUiArray[16], 0, 0, 15, 16,
//#                            uichatStrArray[i + uichatTime_index][2],
//#                            uichatStrArray[i + uichatTime_index][3]);
//#                }
//#            }
//#        } else {
//#            for (int i = 0; i < uichatStrArray.length - 1; i++) {
//#                if (uichatStrArray[i][0] != null) {
//#                    switch (Integer.parseInt(uichatStrArray[i][0])) {
//#                        case 0://综合
//#                            col = 0xffffff;
//#                            break;
//#                        case 1://世界
//#                            col = 0xff7e00;
//#                            break;
//#                        case 2://当前
//#                            col = 0xffffff;
//#                            break;
//#                        case 3://队伍
//#                            col = 0x4eff00;
//#                            break;
//#                        case 4://帮派
//#                            col = 0x0000ff;
//#                            break;
//#                        case 5://系统
//#                            col = 0xefff00;
//#                            break;
//#                        case 6://私聊
//#                            col = 0xff00f0;
//#                            break;
//#                    }
//#                    Tools.drawShadowString(g, uichatStrArray[i][1],
//#                            5, Constant.DRAW_HEIGHT - 17 - (Constant.FONT_SMALL_HEIGHT + 4) - ((Constant.FONT_SMALL.getHeight() + 4) * (uichatStrArray.length - 1 - i)) + 2,
//#                            col, 0x000000,
//#                            roamImgUiArray[16], 0, 0, 15, 16,
//#                            uichatStrArray[i][2],
//#                            uichatStrArray[i][3]);
//#                }
//#            }
//#        }
//#    }
//#endif

    /**
     * 设置快捷小图标
     */
    public Image setQuickSetIcon(Image img) {
        return Tools.ZoomImage(img, 29, 29);
    }
    /**
     * //绘制人物坐标 haitao
     * @param g
     */
    public static int Mssion_index;

//    public void drawSmap(Graphics g) {
//        if (roamImgUiArray[15] != null) {
//            int map_shAreaW = MainLogic.getInstance().gameMap.shAreaW;
//            int map_shAreaH = MainLogic.getInstance().gameMap.shAreaH;
//            int PlayerX = MainLogic.getInstance().gamePlayer.iPlayerX % map_shAreaW;
//            int PlayerY = MainLogic.getInstance().gamePlayer.iPlayerY % map_shAreaH;
//            int iMapStartX = Constant.UI_START_X + Constant.DRAW_WIDTH - 54;
//            int iAvatarStartY = Constant.UI_START_Y + 6;
//            //绘制小地图地形
//            int map_W = 48;
//            int map_H = 48;
//            int mapView_W = 240;//以主角为中心，小地图可视范围
//            int mapView_H = 320;
//            int mapAreaW = mapView_W * 2;//小地图范围
//            int mapAreaH = mapView_H * 2;
//            int mapX;
//            int mapY;
//            int addmapX;
//            int addmapY;
//            //绘制小地图地形
//            for (int i = 0; i < (MainLogic.getInstance().gameMap.shAreaH >> 4); i++) {
//                for (int k = 0; k < (MainLogic.getInstance().gameMap.shAreaW >> 4); k++) {
//                    if (MainLogic.getInstance().gameMap.byCollisionData[i][k] == 1) {
//                        mapX = k * 16;
//                        mapY = i * 16;
//                        addmapX = 0;
//                        addmapY = 0;
//                        if (PlayerX < mapView_W) {
//                            addmapX = mapView_W - PlayerX;
//                        } else if (PlayerX > map_shAreaW - mapView_W) {
//                            addmapX = PlayerX - map_shAreaW + mapView_W;
//                        } else {
//                            addmapX = 0;
//                        }
//                        if (PlayerY < mapView_H) {
//                            addmapY = mapView_H - PlayerY;
//                        } else if (PlayerY > map_shAreaH - mapView_H) {
//                            addmapY = PlayerY - map_shAreaH + mapView_H;
//                        } else {
//                            addmapY = 0;
//                        }
//                        if (Math.abs(PlayerX - mapX) < mapView_W + 16 + addmapX
//                                && Math.abs(PlayerY - mapY) < mapView_H + 16 + addmapY) {
//                            if (PlayerX < mapView_W) {
//                                if (PlayerY < mapView_H) {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 3, 2);
//
//                                } else if (PlayerY > (map_shAreaH - mapView_H)) {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 3, 2);
//                                } else {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + (mapY - PlayerY) * map_H / mapAreaH, 3, 2);
//                                }
//                            } else if (PlayerX > map_shAreaW - mapView_W) {
//                                if (PlayerY < mapView_H) {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 3, 2);
//                                } else if (PlayerY > (map_shAreaH - mapView_H)) {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 3, 2);
//                                } else {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + (mapY - PlayerY) * map_H / mapAreaH, 3, 2);
//                                }
//                            } else {
//                                if (PlayerY < mapView_H) {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + (mapX - PlayerX) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 3, 2);
//                                } else if (PlayerY > (map_shAreaH - mapView_H)) {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + (mapX - PlayerX) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 3, 2);
//                                } else {
//                                    g.setColor(0x666666);
//                                    g.fillRect(iMapStartX + 24 + (mapX - PlayerX) * map_W / mapAreaW,
//                                            iAvatarStartY + 25 + (mapY - PlayerY) * map_H / mapAreaH, 3, 2);
//                                }
//                            }
//                        }
//                    }
//                }
//            }
//        }
//    }
    public void drawSmap(Graphics g) {
        if (roamImgUiArray[15] != null) {
            int map_shAreaW = MainLogic.getInstance().gameMap.shAreaW;
            int map_shAreaH = MainLogic.getInstance().gameMap.shAreaH;
            int PlayerX = MainLogic.getInstance().gamePlayer.iPlayerX % map_shAreaW;
            int PlayerY = MainLogic.getInstance().gamePlayer.iPlayerY % map_shAreaH;
            int iMapStartX = Constant.UI_START_X + Constant.DRAW_WIDTH - 54;
            int iAvatarStartY = Constant.UI_START_Y + 6;
            //绘制小地图地形
            int mapX;
            int mapY;
            int addmapX;
            int addmapY;
            //绘制小地图地形
            for (int i = 0; i < (MainLogic.getInstance().gameMap.shAreaH >> 4); i++) {
                for (int k = 0; k < (MainLogic.getInstance().gameMap.shAreaW >> 4); k++) {
                    if (MainLogic.getInstance().gameMap.byCollisionData[i][k] == 1) {
                        mapX = k * 16;
                        mapY = i * 16;
                        addmapX = 0;
                        addmapY = 0;
                        if (PlayerX < 240) {
                            addmapX = 240 - PlayerX;
                        } else if (PlayerX > map_shAreaW - 240) {
                            addmapX = PlayerX - map_shAreaW + 240;
                        } else {
                            addmapX = 0;
                        }
                        if (PlayerY < 320) {
                            addmapY = 320 - PlayerY;
                        } else if (PlayerY > map_shAreaH - 320) {
                            addmapY = PlayerY - map_shAreaH + 320;
                        } else {
                            addmapY = 0;
                        }
                        if (Math.abs(PlayerX - mapX) < 240 + 16 + addmapX && Math.abs(PlayerY - mapY) < 320 + 16 + addmapY) {
                            if (PlayerX < 240) {
                                if (PlayerY < 320) {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - 240) / 10, iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - 320) * 3 / 40, 3, 2);
                                } else if (PlayerY > (map_shAreaH - 320)) {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - 240) / 10, iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - map_shAreaH + 320) * 3 / 40, 3, 2);
                                } else {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - 240) / 10, iAvatarStartY + 25 + (mapY - PlayerY) * 3 / 40, 3, 2);
                                }
                            } else if (PlayerX > map_shAreaW - 240) {
                                if (PlayerY < 320) {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - map_shAreaW + 240) / 10, iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - 320) * 3 / 40, 3, 2);
                                } else if (PlayerY > (map_shAreaH - 320)) {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - map_shAreaW + 240) / 10, iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - map_shAreaH + 320) * 3 / 40, 3, 2);
                                } else {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + ((mapX - PlayerX) + PlayerX - map_shAreaW + 240) / 10, iAvatarStartY + 25 + (mapY - PlayerY) * 3 / 40, 3, 2);
                                }
                            } else {
                                if (PlayerY < 320) {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + (mapX - PlayerX) / 10, iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - 320) * 3 / 40, 3, 2);
                                } else if (PlayerY > (map_shAreaH - 320)) {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + (mapX - PlayerX) / 10, iAvatarStartY + 25 + ((mapY - PlayerY) + PlayerY - map_shAreaH + 320) * 3 / 40, 3, 2);
                                } else {
                                    g.setColor(0x666666);
                                    g.fillRect(iMapStartX + 24 + (mapX - PlayerX) / 10, iAvatarStartY + 25 + (mapY - PlayerY) * 3 / 40, 3, 2);
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    public void drawPlayerCoordinates(Graphics g) {
        //绘制人物坐标
        if (roamImgUiArray[15] != null) {
            int map_shAreaW = MainLogic.getInstance().gameMap.shAreaW;
            int map_shAreaH = MainLogic.getInstance().gameMap.shAreaH;
            int PlayerX = MainLogic.getInstance().gamePlayer.iPlayerX % map_shAreaW;
            int PlayerY = MainLogic.getInstance().gamePlayer.iPlayerY % map_shAreaH;

            int iMapStartX = Constant.UI_START_X + Constant.DRAW_WIDTH - 54;
            int iAvatarStartY = Constant.UI_START_Y + 6;
            //绘制小地图地形
            int map_W = 48;
            int map_H = 48;
            int mapView_W = 240;//以主角为中心，小地图可视范围
            int mapView_H = 320;
            int mapAreaW = mapView_W * 2;//小地图范围
            int mapAreaH = mapView_H * 2;
            int OtherPlayerX, OtherPlayerY;
            //绘制其他玩家坐标
            for (int i = Constant.MAX_OTHERPLAYER_NUM_IN_SCREEN - 1; i >= 0; i--) {
                if (MainLogic.getInstance().gameOtherplayerArray.shOtherIds[i] != -1) {
                    OtherPlayerX = MainLogic.getInstance().gameOtherplayerArray.iOtherXs[i] % map_shAreaW;
                    OtherPlayerY = MainLogic.getInstance().gameOtherplayerArray.iOtherYs[i] % map_shAreaH;
                    if (Math.abs(PlayerX - OtherPlayerX) < mapView_W
                            && Math.abs(PlayerY - OtherPlayerY) < mapView_H) {
                        if (PlayerX < mapView_W) {
                            if (PlayerY < mapView_H) {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + ((OtherPlayerX - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + ((OtherPlayerY - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                            } else if (PlayerY > (map_shAreaH - mapView_H)) {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + ((OtherPlayerX - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + ((OtherPlayerY - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                            } else {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + ((OtherPlayerX - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + (OtherPlayerY - PlayerY) * map_H / mapAreaH, 4, 4);
                            }
                        } else if (PlayerX > map_shAreaW - mapView_W) {
                            if (PlayerY < mapView_H) {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + ((OtherPlayerX - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + ((OtherPlayerY - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                            } else if (PlayerY > (map_shAreaH - mapView_H)) {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + ((OtherPlayerX - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + ((OtherPlayerY - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                            } else {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + ((OtherPlayerX - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + (OtherPlayerY - PlayerY) * map_H / mapAreaH, 4, 4);
                            }
                        } else {
                            if (PlayerY < mapView_H) {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + (OtherPlayerX - PlayerX) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + ((OtherPlayerY - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                            } else if (PlayerY > (map_shAreaH - mapView_H)) {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + (OtherPlayerX - PlayerX) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + ((OtherPlayerY - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                            } else {
                                g.setColor(0x00ff00);
                                g.fillRect(iMapStartX + 23 + (OtherPlayerX - PlayerX) * map_W / mapAreaW,
                                        iAvatarStartY + 24 + (OtherPlayerY - PlayerY) * map_H / mapAreaH, 4, 4);
                            }
                        }
                    }
                }
            }

            //绘制主角坐标
            if (PlayerX < mapView_W) {
                if (PlayerY < mapView_H) {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23 + (PlayerX - mapView_W) * map_W / mapAreaW,
                            iAvatarStartY + 24 + (PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                } else if (PlayerY > (map_shAreaH - mapView_H)) {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23 + (PlayerX - mapView_W) * map_W / mapAreaW,
                            iAvatarStartY + 24 + (PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                } else {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23 + (PlayerX - mapView_W) * map_W / mapAreaW,
                            iAvatarStartY + 24, 4, 4);
                }
            } else if (PlayerX > map_shAreaW - mapView_W) {
                if (PlayerY < mapView_H) {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23 + (PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                            iAvatarStartY + 24 + (PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                } else if (PlayerY > (map_shAreaH - mapView_H)) {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23 + (PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                            iAvatarStartY + 24 + (PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                } else {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23 + (PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                            iAvatarStartY + 24, 4, 4);
                }
            } else {
                if (PlayerY < mapView_H) {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23,
                            iAvatarStartY + 24 + (PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                } else if (PlayerY > (map_shAreaH - mapView_H)) {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23,
                            iAvatarStartY + 24 + (PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                } else {
                    g.setColor(0xffff00);
                    g.fillRect(iMapStartX + 23,
                            iAvatarStartY + 24, 4, 4);
                }
            }
            //绘制敌人坐标
            for (int i = Constant.MAX_NPC_NUM_IN_SCREEN - 1; i >= 0; i--) {
                if (MainLogic.getInstance().gameNpcArray.shNpcIds[i] != -1
                        && MainLogic.getInstance().gameNpcArray.strNpcResIds[i] != null
                        && MainLogic.getInstance().gameNpcArray.shNpcgender[i] != 3
                        && MainLogic.getInstance().gameNpcArray.shNpcgender[i] != 4) {
                    {
                        int enemy_x = MainLogic.getInstance().gameNpcArray.iNpcXs[i] % map_shAreaW;
                        int enemy_y = MainLogic.getInstance().gameNpcArray.iNpcYs[i] % map_shAreaH;
                        if (Math.abs(PlayerX - enemy_x) < mapView_W
                                && Math.abs(PlayerY - enemy_y) < mapView_H) {
                            if (PlayerX < mapView_W) {
                                if (PlayerY < mapView_H) {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                                    }
                                } else if (PlayerY > (map_shAreaH - mapView_H)) {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                                    }
                                } else {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH, 4, 4);
                                    }
                                }
                            } else if (PlayerX > map_shAreaW - mapView_W) {
                                if (PlayerY < mapView_H) {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                                    }
                                } else if (PlayerY > (map_shAreaH - mapView_H)) {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                                    }
                                } else {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + ((enemy_x - PlayerX) + PlayerX - map_shAreaW + mapView_W) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH, 4, 4);
                                    }
                                }
                            } else {
                                if (PlayerY < mapView_H) {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - mapView_H) * map_H / mapAreaH, 4, 4);
                                    }
                                } else if (PlayerY > (map_shAreaH - mapView_H)) {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + ((enemy_y - PlayerY) + PlayerY - map_shAreaH + mapView_H) * map_H / mapAreaH, 4, 4);
                                    }
                                } else {
                                    if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 2) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 0 : 6, 0,//接受叹号
                                                6, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else if (MainLogic.getInstance().gameNpcArray.byMssionView[i] == 1) {
                                        g.drawRegion(this.roamImgUiArray[15], Mssion_index % 4 < 2 ? 12 : 20, 0,//完成问号
                                                8, 13,
                                                Constant.TRANS_NONE,
                                                iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH,
                                                Graphics.LEFT | Graphics.BOTTOM);
                                    } else {
                                        if (MainLogic.getInstance().gameNpcArray.shNpcTypes[i] == Constant.NPC_TYPE_CANNOTATTACK) {
                                            g.setColor(0x0000ff);
                                        } else {
                                            g.setColor(0xff0000);
                                        }
                                        g.fillRect(iMapStartX + 23 + (enemy_x - PlayerX) * map_W / mapAreaW,
                                                iAvatarStartY + 24 + (enemy_y - PlayerY) * map_H / mapAreaH, 4, 4);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Mssion_index++;

        }
    }

    /**
     * 更新漫游界面的下的
     */
    public void updateRoamUI() {
        if (quickSetCount < 10) {
            quickSetCount++;
        } else {
            quickSetCount = 0;
        }
        if (this.sMarquee != null && this.sMarquee.length() > 0) {
            this.iRoamPositionX = this.iRoamPositionX - 1;
            if (iRoamPositionX < 0 && Math.abs(iRoamPositionX) > Constant.FONT_SMALL.stringWidth(sMarquee)) {
                if (iCount < 3) {
                    iCount++;
                } else {
                    iCount = 0;
                    sMarquee = null;
                }
                //#if NOKIA_S60V5
                 iRoamPositionX = Constant.UI_START_X + 295 + 10;
                //#else
//#                iRoamPositionX = Constant.UI_START_X + 185 + 10;
                //#endif
            }
        }
        //#if NOKIA_S60V5
         if (this.byShowPointPlace > 0) {
             this.byShowPointPlace = (byte) (this.byShowPointPlace == 3 ? 1 : this.byShowPointPlace + 1);
 
         }
        //#endif
    }

    public void clearRoamUI() {
        this.iRoamPositionX = 0;
        this.roamImgUiArray = null;
    }

    /*
    绘制漫游界面下的弹出菜单
     *
     */
    public static byte byLeft;//左右键

    public void initRoamMenu() {
        MainCanvas.clearInput();
        GameBean.b_WAIT_NET_MSG_BACK = false;
        bUiKeyPressLock = false;
        byLeft = 1;
        //#if NOKIA_S60V5
         menu = new String[]{"商城", "角色", "技能", "任务", "背包", "宠物", "地图", "社交", "系统", "聊天", "排行", "摆摊", "活动", "挂机"};
        //#else
//#        menu = new String[]{"1 商城", "2 角色", "3 技能", "4 任务", "5 背包", "6 宠物", "7 地图", "8 社交", "9 系统", "* 聊天"};
        //#endif
        //#if NOKIA_S60V5
         menuImgUiArray = new Image[5];
         menuImgUiArray[3] = ResManager.createImage(90000090);//方向键
         menuImgUiArray[4] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        menuImgUiArray = new Image[3];
        //#endif
        //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
        //#else
        menuImgUiArray[0] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 220, 0x252525);//半透明背景图片
        //#endif
        menuImgUiArray[1] = Tools.makeBlueMask();//蓝光图片
        menuImgUiArray[2] = ResManager.createImage(90000043);
        //寻路状态下停止寻路
        if (MainLogic.getInstance().gamePlayer.byPlayerState == Constant.PLAYER_STATE_AUTO_RUN) {
            MainLogic.getInstance().gamePlayer.changeAction(Constant.PLAYER_STATE_STAND, MainLogic.getInstance().gamePlayer.byPlayerDirection, true, false);
            MainLogic.getInstance().gamePlayer.clearFindPath();
            MainLogic.getInstance().uiEquipment.getChatInformation(100, "", (byte) 5, "寻路已终止！");
        }
    }

    public void setMenu(byte byLeft, byte state, int index) {
        byUiState = state;
        this.byLeft = byLeft;
        if (byLeft == 1) {
            switch (byUiState) {
                case 0:
                case 4://任务
                case 5://背包
                case 7://地图
                case 10://聊天
                    //#if NOKIA_S60V5
                     menu = new String[]{"商城", "角色", "技能", "任务", "背包", "宠物", "地图", "社交", "系统", "聊天", "排行", "摆摊", "活动", "挂机"};
                    //#else
//#                    menu = new String[]{"1 商城", "2 角色", "3 技能", "4 任务", "5 背包", "6 宠物", "7 地图", "8 社交", "9 系统", "* 聊天"};
                    //#endif
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
                case 1://商城
                    menu = new String[]{"1 元宝商城", "2 工资商城", "3 快速充值", "4 购买记录", "5 客户服务", "6 公告信息", "7 充值明细"};//商城
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
                case 2://角色
                    menu = new String[]{"1 属性", "2 装备", "3 状态"};//角色
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
                case 3://技能
                    menu = new String[]{"1 总览", "2 经脉"};//技能
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
                case 6://宠物
                    menu = new String[]{"1 我的宠物", "2 潜能激发", "3 宠物合成"};//技能
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
                case 8://社交
                    menu = new String[]{"1 队伍", "2 附近玩家", "3 好友", "4 帮派"};//社交
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[1]);//菜单宽度
                    break;
                case 9://系统
                    menu = new String[]{"1 快捷键", "2 游戏设置", "3 聊天面板", "4 卡死修复", "5 重新登录", "6 更换角色", "7 退出游戏"};//系统
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[1]);//菜单宽度
                    break;
            }
        } else {
            switch (byUiState) {
                case 0://一级菜单界面
                    menu = new String[]{"1 排行", "2 摆摊", "3 活动", "4 挂机"};
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
                //#if NOKIA_S60V5
                 case 11:
                //#endif
                case 1:
                    menu = new String[]{"1 神之等级榜", "2 神之财富榜", "3 神之杀戮榜", "4 神之帮派榜"};
                    menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[0]);//菜单宽度
                    break;
            }
        }
        //#if NOKIA_S60V5
         menuH = (short) (Constant.FONT_SMALL_HEIGHT + 10);
        //#elif NOKIA_E72
//#         menuH = (short) (Constant.FONT_SMALL_HEIGHT + 2);//每个菜单的高度
        //#else
//#        menuH = (short) (Constant.FONT_SMALL_HEIGHT + 5);//每个菜单的高度
        //#endif
        menuHeight = (short) (menuH * menu.length);//菜单总高度
        iSelectIndex = index;
        //#if NOKIA_S60V5
         iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
        //#else
//#        iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
        //#endif
    }

    /**
     * 绘制弹出菜单层
     */
    public void drawRoamMenu(Graphics g) {
        //#if NOKIA_S60V5
         //绘制半透明背景
         Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT - 57,
                 menuImgUiArray[0], 0, 0, Constant.DRAW_WIDTH, menuImgUiArray[0].getHeight(), Constant.TRANS_NONE);
         Tools.drawBottom(g, menuImgUiArray[2], menuImgUiArray[3], menuImgUiArray[4]);
        //#else
        //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#         g.setColor(0x000000);
//#         g.fillRect(0, 0, Constant.SCREEN_WIDTH, Constant.SCREEN_HEIGHT);
        //#else
//#        //绘制半透明背景
//#        Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT, menuImgUiArray[0], 0, 0, Constant.DRAW_WIDTH, menuImgUiArray[0].getHeight(), Constant.TRANS_NONE);
        //#endif
//#        //绘制确定、返回
        //#if NOKIA_E72
//#         g.drawRegion(menuImgUiArray[2], 0, 0, 24, menuImgUiArray[2].getHeight(), Constant.TRANS_NONE, Constant.UI_START_X + 10, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 16, g.TOP | g.LEFT);
//#         g.drawRegion(menuImgUiArray[2], 49, 0, 23, menuImgUiArray[2].getHeight(), Constant.TRANS_NONE, Constant.UI_START_X + Constant.DRAW_WIDTH - 33, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 16, g.TOP | g.LEFT);
//#         //Tools.drawSelectMask(g, (byte) 2, menuImgUiArray[1], Constant.UI_START_X, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25, Constant.DRAW_WIDTH, null, menuImgUiArray[2], 0, 0, 24, menuImgUiArray[2].getHeight(), menuImgUiArray[2], 49, 0, 23, menuImgUiArray[2].getHeight());
        //#else
//#        Tools.drawSelectMask(g, (byte) 2, menuImgUiArray[1], Constant.UI_START_X, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25, Constant.DRAW_WIDTH, null, menuImgUiArray[2], 0, 0, 24, menuImgUiArray[2].getHeight(), menuImgUiArray[2], 49, 0, 23, menuImgUiArray[2].getHeight());
        //#endif
        //#endif
        //绘制菜单项
        for (int i = 0; i < menu.length; i++) {
            //#if NOKIA_S60V5
             Tools.drawShadowString(g, (byte) 1, menu[i], Constant.UI_START_X + (Constant.DRAW_WIDTH - menuWidth >> 1) - 2,
                     Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1)
                     + i * menuH + (menuH - Constant.FONT_SMALL_HEIGHT >> 1),
                     iSelectIndex == i + 1 ? 0x00CCFF : 0xFFFFFF, 0x000000);
            //#else
//#            Tools.drawShadowString(g, (byte) 1, menu[i], Constant.UI_START_X + (Constant.DRAW_WIDTH - menuWidth >> 1) - 2,
//#                    Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                    + i * menuH + (menuH - Constant.FONT_SMALL_HEIGHT >> 1),
//#                    iSelectIndex == i + 1 ? 0x00CCFF : 0xFFFFFF, 0x000000);
            //#endif
        }
        //绘制选择条
        Tools.drawGapSlectMask(g, menuImgUiArray[1], null, false, menuH, Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
    }

    /**
     * 更新弹出菜单层
     */
    public void updateRoamMenu() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            return;
        }

        if (!bUiKeyPressLock) {
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 1) {
                    iSelectIndex = menu.length;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{1, 1, startY, 2, 50, 5};
                } else {
                    iSelectIndex--;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{2, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == menu.length) {
                    iSelectIndex = 1;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{2, 1, startY, 2, 50, 5};
                } else {
                    iSelectIndex++;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{1, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {
                bUiKeyPressLock = true;
                //#if NOKIA_S60V5
                 if (byLeft == 1) {
                     byLeft = (byte) (iSelectIndex > 10 ? 2 : 1);
                 }
                //#endif
                RoamMenuClickOk(iSelectIndex);
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                bUiKeyPressLock = true;
                if (byUiState == 0) {//直接返回主界面
                    MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                } else {//返回一级菜单
                    //#if NOKIA_S60V5
                     if (byLeft == 1) {
                         setMenu((byte) this.byLeft, (byte) 0, tempIndex > 0 ? tempIndex : 6);
                     } else {
                         setMenu((byte) 1, (byte) 0, 11);
                     }
                    //#else
//#                    setMenu((byte) this.byLeft, (byte) 0, tempIndex > 0 ? tempIndex : 5);
                    //#endif
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 1) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 1) {
                    int temp = iSelectIndex > 1 ? 2 : 1;
                    iSelectIndex = 1;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 2) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 2) {
                    int temp = iSelectIndex > 2 ? 2 : 1;
                    iSelectIndex = 2;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_3, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 3) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 3) {
                    int temp = iSelectIndex > 3 ? 2 : 1;
                    iSelectIndex = 3;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_4, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 4) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 4) {
                    int temp = iSelectIndex > 4 ? 2 : 1;
                    iSelectIndex = 4;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 5) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 5) {
                    int temp = iSelectIndex > 4 ? 2 : 1;
                    iSelectIndex = 5;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_6, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 6) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 6) {
                    int temp = iSelectIndex > 6 ? 2 : 1;
                    iSelectIndex = 6;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_7, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 7) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 7) {
                    int temp = iSelectIndex > 7 ? 2 : 1;
                    iSelectIndex = 7;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_8, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 8) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 8) {
                    int temp = iSelectIndex > 8 ? 2 : 1;
                    iSelectIndex = 8;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_9, false)) {
                bUiKeyPressLock = true;
                if (iSelectIndex == 9) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 9) {
                    int temp = iSelectIndex > 9 ? 2 : 1;
                    iSelectIndex = 9;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_STAR, false)) {//*号键
                bUiKeyPressLock = true;
                if (iSelectIndex == 10) {
                    RoamMenuClickOk(iSelectIndex);
                    return;
                } else if (menu.length >= 10) {
                    int temp = iSelectIndex > 10 ? 2 : 1;
                    iSelectIndex = 10;
                    //#if NOKIA_S60V5
                     startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#else
//#                    startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                    //#endif
                    iArray = new int[]{temp, 1, startY, 2, 50, 5};
                }
            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, iPositionY);
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
        MainCanvas.clearInput();
    }

    public void RoamMenuClickOk(int menuIndex) {
        if (this.byLeft == 1) {
            switch (byUiState) {
                case 0://一级菜单
                    tempIndex = (byte) menuIndex;
                    switch (menuIndex) {
                        case 1://商城
//                        	sysMessage.showMessage("提示", "该功能还没有开放");
                        	///谢亮 暂时注释。
                            setMenu((byte) 1, (byte) iSelectIndex, 2);
                            break;
                        case 2://角色
                            setMenu((byte) 1, (byte) iSelectIndex, 1);
                            break;
                        case 3://技能
                            setMenu((byte) 1, (byte) iSelectIndex, 1);
                            break;
                        case 4://任务
                            GameBean.BY_PRE_GAME_UI_STATE = -1;
                            this.npcTalk.openTaskList();
                            break;
                        case 5://背包
                            MainLogic.getInstance().uiPackage.openBag(Constant.ITEM_COLUMN_TYPE_COMMON);
                            break;
                        case 6://宠物
                            setMenu((byte) 1, (byte) iSelectIndex, 2);
                            break;
                        case 7://地图
                            MainLogic.getInstance().pushState(Constant.GAME_UI_MAP_WORLD, true);
                            break;
                        case 8://社交
                            setMenu((byte) 1, (byte) iSelectIndex, 2);
                            break;
                        case 9://系统
                            setMenu((byte) 1, (byte) iSelectIndex, 3);
                            break;
                        case 10://聊天
                            MainLogic.getInstance().pushState(Constant.GAME_UI_CHAT, true);
                            break;
                    }
                    break;
                case 1://商城
                    switch (iSelectIndex) {
                        case 1://元宝商城
                            MainLogic.getInstance().uiInterFace.store.openIngotStore((byte) 1, (byte) 1);
                            //sysMessage.showMessage("提示", "该功能还没有开放");
                            break;
                        case 2://工资商城
                            MainLogic.getInstance().uiInterFace.store.openIngotStore((byte) 2, (byte) 1);
                            break;
                        case 3://快速充值
                            this.gameSet.openCharge();
                            break;
                        case 4://记录查询
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_MY_INGOT_RECORD, Constant.SOCKET_MSG_TYPE_LOGIC);
                            //sysMessage.showMessage("提示", "该功能还没有开放");
                            break;
                        case 5://客服服务
//                        sysMessage.showMessage("提示", "该功能还没有开放");
                            MainLogic.getInstance().uiEquipment.initSendMail();
                            MainLogic.getInstance().pushState(Constant.GAME_UI_SEND_EMAIL, true);
                            Constant.CMD_MAIL_TYPE = 1;
                            break;
                        case 6://公告信息
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_NOTICE_LIST, Constant.SOCKET_MSG_TYPE_LOGIC);
                            break;
                        case 7:
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHARGE_LIST, Constant.SOCKET_MSG_TYPE_LOGIC);
                            break;
                    }
                    break;
                case 2://角色
                    switch (iSelectIndex) {
                        case 1://属性
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_PROPERTY, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            break;
                        case 2://装备
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_OPEN_EQUIP, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            break;
                        case 3://状态
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_MEFFECT, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            break;
                    }
                    break;
                case 3://技能
                    switch (iSelectIndex) {
                        case 1://总览
                            MainLogic.getInstance().send(Constant.MSG_NET_OPEN_KUNGFU, Constant.SOCKET_MSG_TYPE_LOGIC);
                            break;
                        case 2://经脉
                            MainLogic.getInstance().uiEquipment.meridianschoose_index = 0;
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_OPEN_MERIDIAN, Constant.SOCKET_MSG_TYPE_LOGIC);
                            break;
                    }
                    break;
                case 6://宠物
                    switch (iSelectIndex) {
                        case 1://我的宠物
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            GameBean.L_PLAYER_ID = MainLogic.getInstance().gamePlayer.lPlayerID;
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_OPEN_PET, Constant.SOCKET_MSG_TYPE_LOGIC);
                            break;
                        case 2://激发潜能
                            bUiKeyPressLock = true;
                            MainLogic.getInstance().pushState(Constant.GAME_UI_PET_POWER_STRENGTHEN, true);
                            break;
                        case 3://宠物合成
                            bUiKeyPressLock = true;
                            MainLogic.getInstance().pushState(Constant.GAME_UI_PET_COMPOSE, true);
                            break;
                    }
                    break;
                case 8://社交
                    switch (iSelectIndex) {
                        case 1://队伍
                            if (team.getTeamMemberNum() > 0) {
                                MainLogic.getInstance().pushState(Constant.GAME_UI_TEAM_INFO, true);
                            } else {
                                this.sysMessage.showMessage("提示", "您还没有加入任何队伍!", (byte) 1, (byte) -1);
                            }
                            break;
                        case 2://附近玩家
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_NEAR_PLAYERS, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            break;
                        case 3://好友
                            GameBean.BY_CMD_FRIEND_TYPE = 1;
                            GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_ROAM_MENU;
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_FRIEND_LIST, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            break;
                        case 4://帮派
                            if (MainLogic.getInstance().gamePlayer.sTongName == null) {
                                sysMessage.showMessage("提示", "您还没有加入任何帮派!", (byte) 1, (byte) -1);
                            } else {
                                GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_ROAM_MENU;
                                GameBean.L_CMD_TONG_ID = MainLogic.getInstance().gamePlayer.lTongId;
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_TONG_DESCRIPT, Constant.SOCKET_MSG_TYPE_LOGIC);
                                GameBean.b_WAIT_NET_MSG_BACK = true;
                            }
                            break;
                    }
                    break;
                case 9://系统
                    switch (iSelectIndex) {
                        case 1://快捷键
                            MainLogic.getInstance().pushState(Constant.GAME_UI_GAMESET_QUICKEYS, true);
                            break;
                        case 2://画面效果
//                                sysMessage.showMessage("提示", "该功能还没有开放");
                            MainLogic.getInstance().pushState(Constant.GAME_UI_GAMESET, true);
                            break;
                        case 3://聊天面板
                            MainLogic.getInstance().pushState(Constant.GAME_UI_CHAT, true);
                            break;
                        case 4://卡死修复
                            if (sRoamMapKeys.equals("10101")) {
                                sysMessage.showMessage("提示", "此地图中无法使用该功能!", (byte) 1, (byte) -1);
                            } else {
                                GameBean.STR_SCENCE_KEY = MainLogic.getInstance().uiInterFace.sRoamMapKeys;
                                GameBean.i_SEND_POS_X = 999999;
                                GameBean.i_SEND_POS_Y = 999999;
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_FUNC_SEND, Constant.SOCKET_MSG_TYPE_LOGIC);
                                GameBean.b_WAIT_NET_MSG_BACK = true;
                            }
                            break;
                        case 5://重新登录
                            //sysMessage.showMessage("提示", "该功能还没有开放");
                            MainLogic.getInstance().send(Constant.MSG_NET_QUIT_GAME, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            if (this.isOpenSound) {
                                //#if NOKIAN73 || NOKIA_S40V3  || NORMAL_240_400 || MOTO || K790
                                //#else
                                if (UiInterFace.SetPlayMusic) {
                                    SoundPlayerUtil.stopAllMusic();
                                    SoundPlayerUtil.playmusic(0);
                                    UiInterFace.firstUiMusic = false;
                                }
                                //#endif
                            }
//                        MainLogic.getInstance().exitGame();
                            break;
                        case 6://更换角色
                            MainLogic.getInstance().uiLogin.sArray = new String[2];
                            MainLogic.getInstance().uiLogin.sArray[0] = GameBean.STR_CMD_LOGIN_USENAME;
                            MainLogic.getInstance().uiLogin.sArray[1] = GameBean.STR_CMD_LOGIN_PASSWORD;
                            Rms.loadGame(Constant.RMS_LOGIN_USENAME_PASSWORD);
                            if (MainLogic.getInstance().uiLogin.sArray[0] == null) {
                                MainLogic.getInstance().uiLogin.sArray = null;
                                sysMessage.showMessage("提示", "更换角色失败!");
                            } else {
                                GameBean.STR_CMD_LOGIN_USENAME = MainLogic.getInstance().uiLogin.sArray[0];
                                MainLogic.getInstance().uiLogin.sArray = null;
                                GameBean.BY_CHANGE_PLAYER_ROLE = 1;
                                GameBean.b_WAIT_NET_MSG_BACK = true;
                                MainLogic.getInstance().send(Constant.MSG_NET_QUIT_GAME, Constant.SOCKET_MSG_TYPE_LOGIC);

                            }
                            //sysMessage.showMessage("提示", "该功能还没有开放");
                            break;
                        case 7://退出游戏
                            MainLogic.getInstance().exitGame();

                            break;
                    }
                    break;
            }
        } else {
            switch (byUiState) {
                case 0://一级菜单
                    tempIndex = (byte) menuIndex;
                    switch (menuIndex) {
                        case 11:
                        case 1://排行
                            setMenu((byte) 2, (byte) iSelectIndex, 2);
                            break;
                        case 12:
                        case 2://摆摊
                            MainLogic.getInstance().uiInterFace.store.openStall(MainLogic.getInstance().gamePlayer.lPlayerID);
                            break;
                        case 13:
                        case 3://活动
//                            setMenu((byte) 1, (byte) iSelectIndex, 1);
                            sysMessage.showMessage("提示", "该功能还没有开放");
                            break;
                        case 14:
                        case 4://挂机
                            //离线挂机
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_ONLINEHANG_UI, Constant.SOCKET_MSG_TYPE_LOGIC);
                            GameBean.b_WAIT_NET_MSG_BACK = true;
                            break;
                    }
                    break;
                //#if NOKIA_S60V5
                 case 11://排行
                //#endif
                case 1://排行
                    switch (iSelectIndex) {
                        case 1://神之等级 
                            this.property.openPlayerTop((byte) 1);
                            break;
                        case 2://神之财富 
                            this.property.openPlayerTop((byte) 2);
                            break;
                        case 3://神之杀戮
                            this.property.openPlayerTop((byte) 3);
                            break;
                        case 4://记录帮派
                            this.property.openPlayerTop((byte) 4);
                            break;
                    }
                    break;
            }
        }
    }

    /**
     * 清除漫游界面弹出菜单层
     */
    public void clearRoamMenu() {
        menuImgUiArray = null;
        menu = null;
        this.byLeft = 1;
    }
    /***********************锁定玩家***********************/
    private int[] temp_iLockedObjInfor;
    private long[][] temp_iLockedObjNumber;
    private String temp_strOtherName;
    private long temp_iLockedObjID;

    public void initLockPlayer() {
        bUiKeyPressLock = false;
        byUiState = 0;
        this.byPopUpState = 0;
        menu = new String[]{"1 击杀", "2 私聊", "3 组队", "4 交易", "5 观察", "6 切磋", "7 交友", "8 邀请入帮", "9 摊位"};
        menuWidth = (short) Constant.FONT_SMALL.stringWidth(menu[7]);//菜单宽度
        //#if NOKIA_S60V5
         menuH = (short) (Constant.FONT_SMALL_HEIGHT + 20);
        //#else
//#        menuH = (short) (Constant.FONT_SMALL_HEIGHT + 5);//每个菜单的高度
        //#endif
        menuHeight = (short) (menuH * menu.length);//菜单总高度
        setLockSelect(4);
        sArray = new String[]{"开启PK状态", "您确定要开启PK状态么？"};
        menuImgUiArray = new Image[8];
        menuImgUiArray[0] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 220, 0x252525);//半透明背景图片
        menuImgUiArray[1] = Tools.makeBlueMask();//蓝光图片
        menuImgUiArray[2] = ResManager.createImage(90000043);
        //弹出层边框图片
        menuImgUiArray[5] = Tools.makeTransparent(ResManager.createImage(90000052), 200);
        //弹出层背景图片
        menuImgUiArray[6] = Tools.makeTransparent(10, 88, 200, 0xccb5a1);
        //弹出层选项按钮
        menuImgUiArray[7] = ResManager.createImage(90000044);
        //#if NOKIA_S60V5
         menuImgUiArray[3] = ResManager.createImage(90000090);//方向键
         menuImgUiArray[4] = ResManager.createImage(90000086);//底部蓝条
        //#endif
        temp_iLockedObjInfor = MainLogic.getInstance().iLockedObjInfor;
        temp_iLockedObjNumber = MainLogic.getInstance().iLockedObjNumber;
        temp_iLockedObjID = MainLogic.getInstance().lLockedId;
        short index = (short) temp_iLockedObjNumber[0][1];
        temp_strOtherName = MainLogic.getInstance().gameOtherplayerArray.strOtherNames[index];
    }

    public void setLockSelect(int selectIndex) {
        iSelectIndex = selectIndex;
//        iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT  - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
        //#if NOKIA_S60V5
         iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
        //#else
//#        iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
        //#endif
    }

    public void updateLockPlayer() {
        if (!bUiKeyPressLock) {
            switch (byUiState) {
                case 0:
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 1) {
                            iSelectIndex = menu.length;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{1, 1, startY, 2, 50, 5};
                        } else {
                            iSelectIndex--;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{2, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == menu.length) {
                            iSelectIndex = 1;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{2, 1, startY, 2, 50, 5};
                        } else {
                            iSelectIndex++;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{1, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {
                        LockPlayerClickOK(iSelectIndex);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 1) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 1) {
                            int temp = iSelectIndex > 1 ? 2 : 1;
                            iSelectIndex = 1;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 2) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 2) {
                            int temp = iSelectIndex > 2 ? 2 : 1;
                            iSelectIndex = 2;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_3, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 3) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 3) {
                            int temp = iSelectIndex > 3 ? 2 : 1;
                            iSelectIndex = 3;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_4, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 4) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 4) {
                            int temp = iSelectIndex > 4 ? 2 : 1;
                            iSelectIndex = 4;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 5) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 5) {
                            int temp = iSelectIndex > 4 ? 2 : 1;
                            iSelectIndex = 5;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_6, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 6) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 6) {
                            int temp = iSelectIndex > 6 ? 2 : 1;
                            iSelectIndex = 6;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_7, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 7) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 7) {
                            int temp = iSelectIndex > 7 ? 2 : 1;
                            iSelectIndex = 7;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_8, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 8) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 8) {
                            int temp = iSelectIndex > 8 ? 2 : 1;
                            iSelectIndex = 8;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_9, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 9) {
                            LockPlayerClickOK(iSelectIndex);
                            return;
                        } else if (menu.length >= 9) {
                            iSelectIndex = 9;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 57 - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (iSelectIndex - 1) * menuH;
                            //#endif
                            iArray = new int[]{iSelectIndex > 9 ? 2 : 1, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                    }
                    break;
                case 1:
                    if (byPopUpState < 4) {
                        byPopUpState++;
                        MainCanvas.clearInput();
                        return;
                    }
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || (MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)))) {//开启PK状态
                        bUiKeyPressLock = true;
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_PK, Constant.SOCKET_MSG_TYPE_LOGIC);
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                        MainLogic.getInstance().gamePlayer.byPlayerBigState = Constant.PLAYER_BIG_STATE_FIGHT;
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//取消开启PK状态
                        bUiKeyPressLock = true;
                        byUiState = 0;
                    }
                    break;

            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, iPositionY);
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
        MainCanvas.clearInput();
    }

    public void drawLockPlayer(Graphics g) {
        drawRoamMenu(g);
        if (byUiState == 1) {
            Tools.drawPopUp(g, byPopUpState, Constant.UI_START_X + 10, Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 80 >> 1),
                    Constant.DRAW_WIDTH - 20, 80, menuImgUiArray[5], menuImgUiArray[6], (byte) 1,
                    menuImgUiArray[7], 22, 0, 21, menuImgUiArray[7].getHeight(), menuImgUiArray[7], 0, 0, 22, menuImgUiArray[7].getHeight(), sArray[0], sArray[1]);

        }
    }

    public void LockPlayerClickOK(int menIindex) {
        switch (menIindex) {
            case 1://击杀
                if (GameBean.BY_SAFE_MAP == 0) {
                    MainLogic.getInstance().uiInterFace.uichat_index = 0;
                    MainLogic.getInstance().uiEquipment.getChatInformation(100, "", (byte) 5, "安全区禁止恶意pk!");
                } else if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                    if (MainLogic.getInstance().sLockedTongNo == null
                            || MainLogic.getInstance().gamePlayer.sTongName != MainLogic.getInstance().sLockedTongNo) {//不同阵营
                        MainLogic.getInstance().gamePlayer.byPlayerBigState = Constant.PLAYER_BIG_STATE_FIGHT;
                    } else {//同一阵营
                        MainLogic.getInstance().uiEquipment.getChatInformation(100, "", (byte) 5, "对方与你属于同一阵营，请勿暗下毒手!");
                    }
                } else {
                    if (team.getMemberPos(temp_iLockedObjID) != -1) {
                        MainLogic.getInstance().uiInterFace.uichat_index = 0;
                        MainLogic.getInstance().uiEquipment.getChatInformation(100, "", (byte) 5, "在同一队伍中，不能PK!");
                    } else {
                        if (MainLogic.getInstance().gamePlayer.iPlayerLevel < 20) {
                            MainLogic.getInstance().uiEquipment.getChatInformation(100, "", (byte) 5, "你涉世未深，不要暗下毒手!");
                        } else if (MainLogic.getInstance().gamePlayer.bPkState == 0) {//未开启PK状态
                            byUiState = 1;
                        } else if (temp_iLockedObjInfor[0] < 20) {
                            MainLogic.getInstance().uiEquipment.getChatInformation(100, "", (byte) 5, "对方涉世未深，怎忍心下此毒手!");
                        } else {//战斗
                            MainLogic.getInstance().gamePlayer.byPlayerBigState = Constant.PLAYER_BIG_STATE_FIGHT;
                        }
                    }
                }
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                break;
            case 2://私聊
                GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_VIEW_OTHER_PLAYER;
                GameBean.BY_CMD_FRIEND_TYPE = 1;
                GameBean.BY_CMD_FRIEND_NAME = temp_strOtherName;
                UiEquipment.chatOtherplayerId = temp_iLockedObjID;
                MainLogic.getInstance().uiEquipment.chatOtherplayerName = GameBean.BY_CMD_FRIEND_NAME;
                if (MainLogic.getInstance().uiEquipment.chatOtherplayerName.equals(MainLogic.getInstance().gamePlayer.sPlayerName)) {
                    MainLogic.getInstance().uiEquipment.chatOtherplayerName = "";
                }
                MainLogic.getInstance().uiEquipment.chatshoutType = 3;
                MainLogic.getInstance().pushState(Constant.GAME_UI_CHAT, true);
                MainLogic.getInstance().inputInterFace.setInputInterFace(Constant.GAME_UI_CHAT, "私聊发送聊天");
                MainLogic.getInstance().inputInterFace.commonInput.setString(null);
                MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                break;
            case 3://组队
                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                    sysMessage.showMessage("提示", "战场中无法组队!", (byte) 1, (byte) -1);
                } else {
                    if (team.getTeamMemberNum() <= 0) {
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_TEAM_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                        sysMessage.showMessage("提示", "请求已经发出!", (byte) 1, (byte) -1);
                    } else if (team.getTeamMemberNum() < Constant.MAX_TEAM_MEMBER_NUM) {
                        if (team.getMemberPos(GameBean.L_PLAYER_ID) != -1) {
                            sysMessage.showMessage("提示", "该玩家已在您的队伍中!", (byte) 1, (byte) -1);
                        } else if (!team.isMeLeader()) {
                            sysMessage.showMessage("提示", "只有队长才能邀请玩家入队!", (byte) 1, (byte) -1);
                        } else {
                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_TEAM_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                            sysMessage.showMessage("提示", "请求已经发出!", (byte) 1, (byte) -1);
                        }
                    } else {
                        sysMessage.showMessage("提示", "队伍人数已满!", (byte) 1, (byte) -1);
                    }
                }
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                break;
            case 4://交易
                GameBean.BY_TYPE = 1;//(1,交易,2:切磋)
                GameBean.STR_CMD_PLAYER_NICK = temp_strOtherName;
                UiEquipment.chatOtherplayerId = temp_iLockedObjID;
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_TRADE_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                sysMessage.showMessage("提示", "交易请求已发出!", (byte) 1, (byte) -1);
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                break;
            case 5://观察
                GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_VIEW_OTHER_PLAYER;
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_OTHER_PLAYER_DETAIL, Constant.SOCKET_MSG_TYPE_LOGIC);
                break;
            case 6://切磋
                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                    sysMessage.showMessage("提示", "战场中无法切磋!", (byte) 1, (byte) -1);
                } else {
                    GameBean.BY_TYPE = 2;//(1,交易,2:切磋)
                    MainLogic.getInstance().gamePlayer.otherPlayerId = temp_iLockedObjID;
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_TRADE_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                    sysMessage.showMessage("提示", "请求已发出!", (byte) 1, (byte) -1);
                }
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                break;
            case 7://交友
                GameBean.BY_CMD_FRIEND_TYPE = 1;
                GameBean.BY_CMD_FRIEND_MODE = 1;
                GameBean.BY_CMD_FRIEND_NAME = temp_strOtherName;
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_ADD_FRIEND, Constant.SOCKET_MSG_TYPE_LOGIC);
                GameBean.b_WAIT_NET_MSG_BACK = true;
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                break;
            case 8://邀请入帮
                if (MainLogic.getInstance().gamePlayer.sTongName == null) {
                    sysMessage.showMessage("提示", "您没有邀请其他玩家加入帮派的权限!", (byte) 1, (byte) -1);
                } else if (temp_iLockedObjInfor[0] < 20) {
                    sysMessage.showMessage("提示", "对方级别尚低，不能加入帮派!", (byte) 1, (byte) -1);
                } else {
                    GameBean.BY_CMD_INVITE_TONG_TYPE = 1;
                    MainLogic.getInstance().send(Constant.MSG_NET_INVITE_TONG, Constant.SOCKET_MSG_TYPE_LOGIC);
                    sysMessage.showMessage("提示", "请求已经发出!", (byte) 1, (byte) -1);
                }
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                break;
            case 9://查看其他玩家的摊位
                MainLogic.getInstance().uiInterFace.store.openStall(temp_iLockedObjID);
                break;
        }
    }

    public void clearLockPlayer() {
        menu = null;
        menuImgUiArray = null;
        sArray = null;
        temp_iLockedObjInfor = null;
        temp_iLockedObjNumber = null;
        temp_strOtherName = null;
        temp_iLockedObjID = -1;
    }

    /****************************查看其他玩家**********************************/
    public void initOtherPlayerLooked() {
        GameBean.b_WAIT_NET_MSG_BACK = false;
        byUiState = 0;
        byPopUpState = 0;
        iSelectIndex = 1;
        //#if NOKIA_S60V5
         imgUiArray = new Image[14];
         imgUiArray[11] = ResManager.createImage(90000084);//方向键
         imgUiArray[12] = ResManager.createImage(90000085);//确定键
         imgUiArray[13] = ResManager.createImage(90000086);//底部蓝条
         iPositionY = Constant.UI_START_Y + 41 + 41;
        //#else
//#        iPositionY = Constant.UI_START_Y + 21 + 28;
//#        imgUiArray = new Image[11];
        //#endif
        try {
            //#if NOKIA_S40V3 || MOTO || K790
            //#elif NORMAL_240_400
//# //            imgUiArray[0] = ResManager.createImage(90000017);
//# //            imgUiArray[0] = Tools.ZoomImage(imgUiArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#else
            //背景图片
            imgUiArray[0] = ResManager.createImage(90000017);//背景图片
            //#endif
            imgUiArray[1] = ResManager.createImage(90000041);//箭头图片
            imgUiArray[2] = Tools.makeBlueMask();//蓝光图片
            imgUiArray[3] = ResManager.createImage(90000043);//确定、返回图片
            imgUiArray[6] = Tools.makeTransparent(28, 28, 80, 0xFF0000);
            imgUiArray[7] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
            imgUiArray[8] = ResManager.createImage(90000044);//确定、返回图片（灰色）
            imgUiArray[9] = Tools.makeTransparent(218, 20, 220, 0x989898);
            imgUiArray[10] = Tools.makeTransparent(28, 28, 180, 0xff0000);
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
        }
        this.sDataArray = null;//玩家的昵称数组
        this.bFlag = false;//是否已经获得了玩家的昵称
        sArray = new String[]{"观察", "角色信息", "宠物信息", "LV", "小菜鸟", "武师", "帮派：", "称号：", "攻击力：", "防御力：",
            "修为：", "血气：", "精气：", "命中：", "闪避：", "PK值：", "帮派代号", "称号名称", "300", "600", "200",
            "200", "5000", "20", "50", "90", "物品查看"};
        equipGoods = new Goods(Constant.PLAYER_WEAR_EQUIP_NUM, Constant.ITEM_COLUMN_TYPE_EQUIP);
        sEquipPlaceName = Goods.getEquipPlaceName();
        //#if NOKIA_E72
//#         Tools.initE72ScollBar();
        //#endif
    }

    public void getOtherPlayerInfo(int playerLv, String playerName, byte playerDuty, String tongName, byte name, int[] data) {
        sArray[3] = "LV" + playerLv;
        otherPlayerName = playerName;
        if (playerName.length() > 8) {
            sArray[4] = playerName.substring(0, 7) + "…";
        } else {
            sArray[4] = playerName;
        }
        sArray[5] = Tools.getJobName(playerDuty);
        sArray[16] = tongName.equals("") ? "无" : tongName;
        if (tongName.equals("")) {
            sArray[16] = "无";
        } else if (tongName.length() > 5) {
            sArray[16] = tongName.substring(0, 4) + "…";
        } else {
            sArray[16] = tongName;
        }
        sArray[17] = "称号：" + Tools.nickIDToName((byte) name);//玩家的称号

        for (int i = 0; i < data.length; i++) {
            sArray[i + 18] = "" + data[i];
        }
    }

    public void setPlayerNick(byte[] byNicks) {
        this.bFlag = true;
        if (byNicks == null) {
            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "玩家还没有任何的称号!");
            return;
        }
        this.sDataArray = new String[byNicks.length];
        for (byte i = 0; i < byNicks.length; i++) {
            sDataArray[i] = Tools.nickIDToName(byNicks[i]);
        }
        this.byUiState = 2;
        this.iSelectIndex = 4;
    }

    public void updateOtherPlayerLooked() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            return;
        }
        if (!bUiKeyPressLock) {
            switch (byUiState) {
                case 0:
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        iSubSelectIndex = 1;
                        if (iSelectIndex == 1) {
                            iSelectIndex = 4;
                            //#if NOKIA_S60V5
                             int h = Constant.FONT_SMALL_HEIGHT + 1;
                             startY = Constant.UI_START_Y + 133 + h + (42 + h) * (iSelectIndex - 2) + 5 * h;
                            //#else
                            //#if NOKIA_E72
//#                             Tools.updateE72ScollBar(-80);
                            //#endif
//#                            startY = Constant.UI_START_Y + 97 + (30 + Constant.FONT_SMALL_HEIGHT) * (iSelectIndex - 2) + 5 * Constant.FONT_SMALL_HEIGHT + this.iScreenOffsetH;
                            //#endif
                            iArray = new int[]{1, 1, startY, 2, 50, 5};
                        } else {
                            iSelectIndex--;
                            if (iSelectIndex == 1) {
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + 41 + 41;
                                //#else
                                //#if NOKIA_E72
//#                                 Tools.updateE72ScollBar(0);
                                //#endif
//#                                startY = Constant.UI_START_Y + 21 + 28 + this.iScreenOffsetH;
                                //#endif
                            } else {
                                //#if NOKIA_S60V5
                                 int h = Constant.FONT_SMALL_HEIGHT + 1;
                                 startY = Constant.UI_START_Y + 133 + h + (42 + h) * (iSelectIndex - 2);
                                //#else
                                //#if NOKIA_E72
//#                                 Tools.updateE72ScollBar(iSelectIndex == 3 ? -80 : 0);
                                //#endif
//#                                startY = Constant.UI_START_Y + 97 + (30 + Constant.FONT_SMALL_HEIGHT) * (iSelectIndex - 2) + this.iScreenOffsetH;
                                //#endif
                            }
                            iArray = new int[]{2, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        iSubSelectIndex = 1;
                        if (iSelectIndex == 4) {
                            iSelectIndex = 1;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + 41 + 41;
                            //#else
                            //#if NOKIA_E72
//#                             Tools.updateE72ScollBar(0);
                            //#endif
//#                            startY = Constant.UI_START_Y + 21 + 28 + this.iScreenOffsetH;
                            //#endif
                            iArray = new int[]{2, 1, startY, 2, 50, 5};
                        } else {
                            iSelectIndex++;
                            int addH = 0;

                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + 133 + (Constant.FONT_SMALL_HEIGHT + 1) + (42 + Constant.FONT_SMALL_HEIGHT + 1) * (iSelectIndex - 2);
                             if (iSelectIndex == 4) {
                                 addH += Constant.END_LINE - startY;
                             }
                             startY += addH;
                            //#else
//#                            if (iSelectIndex == 4) {
//#                                addH += 5 * Constant.FONT_SMALL_HEIGHT;
//#                            }
                            //#if NOKIA_E72
//#                             Tools.updateE72ScollBar(iSelectIndex == 4 ? -80 : 0);
                            //#endif
//#                            startY = Constant.UI_START_Y + 97 + (30 + Constant.FONT_SMALL_HEIGHT) * (iSelectIndex - 2) + addH + this.iScreenOffsetH;
//#                            ;
                            //#endif
                            iArray = new int[]{1, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 1) {//跳到宠物信息
                            pet.getOtherPlayerPetEquip(GameBean.L_PLAYER_ID, otherPlayerName);
                        } else {
                            iSubSelectIndex = iSubSelectIndex == 1 ? 5 : (iSubSelectIndex - 1);
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 1) {//跳到宠物信息
                            pet.getOtherPlayerPetEquip(GameBean.L_PLAYER_ID, otherPlayerName);
                        } else {
                            iSubSelectIndex = iSubSelectIndex == 5 ? 1 : (iSubSelectIndex + 1);
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {//确定
                        bUiKeyPressLock = true;
                        switch (iSelectIndex) {
                            case 2:
                            case 3:
                                if (iSubSelectIndex < equipGoods.getMaxColumNum()
                                        && equipGoods.checkColumnHasGoods((byte) ((iSubSelectIndex - 1) + (iSelectIndex - 2) * 5))) {
                                    menu = Goods.getGoodsOperation(Constant.ITEM_COLUMN_TYPE_OTHERPLAYER_EQUIP,
                                            Goods.getEquipmentType(equipGoods.getGoodsEquipPlace((byte) ((iSubSelectIndex - 1) + (iSelectIndex - 2) * 5))));
                                    byUiState = 1;
                                }
                                break;
                            case 4:
                                if (!this.bFlag) {
//                                    GameBean.b_WAIT_NET_MSG_BACK = true;
                                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_PLAYER_NICK, Constant.SOCKET_MSG_TYPE_LOGIC);
                                } else {
                                    if (this.sDataArray == null) {
                                        this.sysMessage.showMessage("提示", "该玩家暂时还没有任何的称号!");
                                    } else {
                                        this.byUiState = 2;
                                    }
                                }
                                break;

                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                        switch (GameBean.BY_PRE_GAME_UI_STATE) {
                            case Constant.GAME_UI_VIEW_OTHER_PLAYER:
                                MainLogic.getInstance().pushState(Constant.GAME_UI_VIEW_OTHER_PLAYER, true);
                                MainLogic.getInstance().uiInterFace.setLockSelect(5);
                                break;
                            case Constant.GAME_UI_NEAR_PLAYER_LIST:
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_CHECK_NEAR_PLAYERS, Constant.SOCKET_MSG_TYPE_LOGIC);
                                break;
                            case Constant.GAME_UI_TEAM_INFO:
                                MainLogic.getInstance().pushState(Constant.GAME_UI_TEAM_INFO, true);
                                break;
                            case Constant.GAME_UI_FRIEND_LIST:
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_FRIEND_LIST, Constant.SOCKET_MSG_TYPE_LOGIC);
                                GameBean.b_WAIT_NET_MSG_BACK = true;
                                break;
                            case Constant.GAME_UI_CHAT:
                                MainLogic.getInstance().pushState(Constant.GAME_UI_CHAT, true);
                                break;
                            case Constant.GAME_UI_PLAYER_TOP:
                                //#if NOKIA_S60V5
                                 Tools.openRoamMenu(false, (byte) 1, (byte) 0, 11);
                                //#else
//#                                Tools.openRoamMenu(false, (byte) 2, (byte) 0, 1);
                                //#endif
                                break;
                            default:
                                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                                break;
                        }
                    }
                    break;
                case 1:
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {//查看
                        bUiKeyPressLock = true;
                        this.byUiState = 0;
                        MainLogic.getInstance().uiInterFace.sysMessage.checkItem(equipGoods.sAlias[(iSubSelectIndex - 1) + (iSelectIndex - 2) * 5], equipGoods.byColor[(iSubSelectIndex - 1) + (iSelectIndex - 2) * 5], equipGoods.icon[(iSubSelectIndex - 1) + (iSelectIndex - 2) * 5], GameBean.L_PLAYER_ID, equipGoods.byPlace[(iSubSelectIndex - 1) + (iSelectIndex - 2) * 5]);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                        bUiKeyPressLock = true;
                        byUiState = 0;
                    }
                    break;
                case 2:
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//开启PK状态
                        byUiState = 0;
                    }
                    break;
            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, iPositionY);
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
    }

    public void drawOtherPlayerLooked(Graphics g) {
        int w = 0;
        int h = 0;
        int selectColor = 0x00CCFF;
        int blackColor = 0x000000;
        int whiteColor = 0xFFFFFF;
        //绘制背景
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[11], imgUiArray[12], imgUiArray[13], imgUiArray[3], sArray[0]);
         h = iSelectIndex == 1 ? 41 : 20;
        //#else
        //#if NOKIA_E72
//#         Tools.drawE72Frame(g, imgUiArray[0], imgUiArray[3], sArray[0]);
        //#else
//#        Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[2],
//#                imgUiArray[3], 0, 0, 24, imgUiArray[3].getHeight(), imgUiArray[3], 49, 0, 23, imgUiArray[3].getHeight(),
//#                sArray[0], whiteColor);
        //#endif
//#        h = iSelectIndex == 1 ? 28 : 17;
        //#endif
        //绘制选择条
        startX = Constant.UI_START_X + 0;
        w = Constant.DRAW_WIDTH;
        if (iSelectIndex != 4) {
            Tools.drawGapSlectMask(g, imgUiArray[2], null, false, h, startX, iPositionY, w);
        } else {
            Tools.drawSelectMask(g, (byte) 1, imgUiArray[2], startX, iPositionY, w);
        }
        //绘制级别、昵称、职业
        //#if NOKIA_S60V5
         h = 41;
         startY = Constant.UI_START_Y + 41 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        h = 28;
//#        startY = Constant.UI_START_Y + 21 + (h - Constant.FONT_SMALL_HEIGHT >> 1) + this.iScreenOffsetH;
        //#endif
        w = Constant.DRAW_WIDTH / 3;
        for (int i = 0; i < 3; i++) {
            startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[3 + i]) >> 1) + w * i;
            if (i == 1) {
                int nameColor = 0xffffff;
                if (Integer.parseInt(sArray[25]) > 0 && Integer.parseInt(sArray[25]) < 30) {
                    nameColor = 0xffcc00;
                } else if (Integer.parseInt(sArray[25]) >= 30) {
                    nameColor = 0xff3333;
                }
                Tools.drawShadowString(g, (byte) 1, sArray[3 + i], startX, startY, nameColor, blackColor);
            } else {
                Tools.drawShadowString(g, (byte) 1, sArray[3 + i], startX, startY, whiteColor, blackColor);
            }
        }
        //绘制角色信息
        w = Constant.DRAW_WIDTH >> 1;
        startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
        startY = Constant.UI_START_Y + (h << 1) + (h - Constant.FONT_SMALL_HEIGHT >> 1) + this.iScreenOffsetH;
        Tools.drawShadowString(g, (byte) 1, sArray[1], startX, startY, selectColor, blackColor);
        //绘制宠物攻击
        startX = Constant.UI_START_X + w + (w - Constant.FONT_SMALL.stringWidth(sArray[2]) >> 1);
        Tools.drawShadowString(g, (byte) 1, sArray[2], startX, startY, whiteColor, blackColor);
        //绘制角色信息的左右箭头
        startX = Constant.UI_START_X + (w - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1) - 3 - 5;//5为箭头图片的宽度
        startY = startY + (Constant.FONT_SMALL_HEIGHT - 7 >> 1) + this.iScreenOffsetH;//7为箭头图片的高度
        Tools.drawArrow(g, imgUiArray[1], (byte) 1, startX, startY);//向左的箭头
        startX = startX + 3 + 5 + Constant.FONT_SMALL.stringWidth(sArray[1]) + 3;
        Tools.drawArrow(g, imgUiArray[1], (byte) 2, startX, startY);//向右的箭头
        //绘制装备
        //装备名称
        //#if NOKIA_S60V5
         startX = Constant.UI_START_X + 25;
         startY = Constant.UI_START_Y + h * 3;
        //#else
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 170 >> 1);
//#        startY = Constant.UI_START_Y + 21 + 28 + (h - Constant.FONT_SMALL_HEIGHT >> 1) + Constant.FONT_SMALL_HEIGHT + this.iScreenOffsetH;
        //#endif
        if (equipGoods.checkColumnHasGoods((short) ((iSubSelectIndex - 1) + (iSelectIndex - 2) * 5))) {
            Goods.drawGoodsName(g, equipGoods.getGoodsColor((short) ((iSubSelectIndex - 1) + (iSelectIndex - 2) * 5)),
                    equipGoods.getGoodsAlias((short) ((iSubSelectIndex - 1) + (iSelectIndex - 2) * 5)), startX, startY);
        }
        //#if NOKIA_S60V5
         startX = Constant.UI_START_X + 25;
         h = Constant.FONT_SMALL_HEIGHT + 1;
         startY += h;
        //#else
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 170 >> 1);
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        startY += h;
        //#endif
        for (short i = 0; i < Constant.PLAYER_WEAR_EQUIP_NUM; i++) {
            if (i == 5) {
                //#if NOKIA_S60V5
                 startX = Constant.UI_START_X + 25;
                 startY += (42 + h);
                //#else
//#                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 170 >> 1);
//#                startY = startY + 30 + h;
                //#endif
            }
            //绘制装备
            equipGoods.drawEquipment(g, startX, startY, i);
            //#if NOKIA_S60V5
             Tools.drawShadowString(g, (byte) 1, sEquipPlaceName[i], startX + ((41 - Constant.FONT_SMALL.stringWidth(sEquipPlaceName[i])) >> 1),
                     startY + 41, whiteColor, blackColor);
             startX += 67;
            //#else
//#            Tools.drawShadowString(g, (byte) 1, sEquipPlaceName[i], startX + ((30 - Constant.FONT_SMALL.stringWidth(sEquipPlaceName[i])) >> 1),
//#                    startY + 30, whiteColor, blackColor);
//#            startX += 37;
            //#endif
        }
        //暂时修改
        //绘制左边
        //#if NOKIA_S60V5
         startY += (h + 42);
         h = (Constant.END_LINE - startY) / 5;
         startY += (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        startY += (30 + h);
        //#endif
        //#if NOKIA_E72
//#         startX = Constant.UI_START_X + 40;
        //#else 
        startX = Constant.UI_START_X + 10;
        //#endif
        Tools.drawShadowString(g, (byte) 1, sArray[6], startX, startY, whiteColor, blackColor);//帮派
        Tools.drawShadowString(g, (byte) 1, sArray[8], startX, startY + h, whiteColor, blackColor);//攻击力
        Tools.drawShadowString(g, (byte) 1, sArray[9], startX, startY + 2 * h, whiteColor, blackColor);//防御力
        Tools.drawShadowString(g, (byte) 1, sArray[15], startX, startY + 3 * h, whiteColor, blackColor);//PK
        //绘制其他玩家的称号:
        Tools.drawShadowString(g, (byte) 1, sArray[17], startX, startY + 4 * h, iSelectIndex == 4 ? selectColor : whiteColor, blackColor, Graphics.TOP | Graphics.LEFT);
        //称号
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH >> 1) - 10;
        Tools.drawShadowString(g, (byte) 1, sArray[16], startX, startY, whiteColor, blackColor, Graphics.TOP | Graphics.RIGHT);
        Tools.drawShadowString(g, (byte) 1, sArray[18], startX, startY + h, whiteColor, blackColor, Graphics.TOP | Graphics.RIGHT);
        Tools.drawShadowString(g, (byte) 1, sArray[19], startX, startY + 2 * h, whiteColor, blackColor, Graphics.TOP | Graphics.RIGHT);
        Tools.drawShadowString(g, (byte) 1, sArray[25], startX, startY + 3 * h, whiteColor, blackColor, Graphics.TOP | Graphics.RIGHT);
        //绘制右边
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH >> 1) + 10;
        for (int i = 0; i < 4; i++) {
            Tools.drawShadowString(g, (byte) 1, sArray[i + 11], startX, startY + h * i, whiteColor, blackColor);
        }
        //#if NOKIA_E72
//#         startX = Constant.UI_START_X + Constant.DRAW_WIDTH - 40;
        //#else 
        startX = Constant.UI_START_X + Constant.DRAW_WIDTH - 10;
        //#endif
        for (int i = 0; i < 4; i++) {
            Tools.drawShadowString(g, (byte) 1, sArray[i + 21], startX, startY + h * i, whiteColor, blackColor, Graphics.TOP | Graphics.RIGHT);
        }

        if (iSelectIndex > 1 && iSelectIndex < 4) {
            //#if NOKIA_S60V5
             startX = Constant.UI_START_X + 26 + (iSubSelectIndex - 1) * 67;
             startY = Constant.UI_START_Y + 124 + Constant.FONT_SMALL_HEIGHT + (iSelectIndex - 2) * (42 + Constant.FONT_SMALL_HEIGHT + 1);
            //#else
//#            startX = Constant.UI_START_X + ((Constant.DRAW_WIDTH - 170) >> 1) + (iSubSelectIndex - 1) * 37;
//#            startY = Constant.UI_START_Y + 21 + 28 + (28 - Constant.FONT_SMALL_HEIGHT >> 1) + Constant.FONT_SMALL_HEIGHT * 2
//#                    + (iSelectIndex - 2) * (30 + Constant.FONT_SMALL_HEIGHT) + this.iScreenOffsetH;
            //#endif
            equipGoods.drawSelectStyle(g, startX, startY);
            if (byUiState == 1) {
                Goods.drawGoodsOperationMenu(g, menu, (byte) 0, startX, startY);
            }
        }

        if (this.byUiState == 2) {
            //#if NOKIA_S60V5
             w = 318;
            //#elif NOKIA_E72
//#             w = 300;
            //#else
//#            w = 232;
            //#endif

            h = this.sDataArray.length * (Constant.FONT_SMALL_HEIGHT + 10) + 10;
            h = h > 80 ? h : 80;
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
            //#if NOKIA_S60V5
             startY = Constant.UI_START_X + (Constant.END_LINE - h >> 1);
             Tools.drawRoundRect(g, this.imgUiArray[7], 0x9c9c9c, w, h, startX, startY);
            //#else
//#            startY = Constant.UI_START_X + (Constant.DRAW_HEIGHT - h >> 1);
//#            Tools.drawRoundRect(g, imgUiArray[7], 0x989898, w, h, startX, startY);
            //#endif
            startY += (h - (Constant.FONT_SMALL_HEIGHT + 10) * this.sDataArray.length + 10 >> 1);
            for (byte i = 0; i < sDataArray.length; i++) {
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sDataArray[i]) >> 1);
                Tools.drawShadowString(g, (byte) 1, this.sDataArray[i], startX, startY, whiteColor, blackColor);
                startY += Constant.FONT_SMALL_HEIGHT + 10;
            }
        }
        //#if NOKIA_E72
//#         Tools.drawE72ScrollBar(g);
        //#endif
        
        ////////
        //Yujiang
        MainView.drawTouchRect(g, mOtherPlayerLookedTouchRect);
        
    }

    public void clearOtherPlayerLooked() {
        imgUiArray = null;
        sArray = null;
        equipGoods = null;
        sEquipPlaceName = null;
        menu = null;
        otherPlayerName = null;
        //#if NOKIA_E72
//#         Tools.clearE72ScollBar();
        //#endif
    }
    /**************************死亡复活*******************************/
    private int level;//等级
    private long time, startTime, endTime;//等待选择时间

    public void initRevive() {

        //#if NOKIA_S60V5
         imgUiArray = new Image[9];
         imgUiArray[5] = ResManager.createImage(90000090);//方向键
         imgUiArray[6] = ResManager.createImage(90000086);//底部蓝条
         imgUiArray[7] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 220, 0x252525);//半透明背景图片
         imgUiArray[8] = ResManager.createImage(90000043);//确定文字
        //#else
//#        imgUiArray = new Image[5];
        //#endif
        try {
            //箭头图片
            this.imgUiArray[0] = ResManager.createImage(90000041);
            //蓝色光片
            this.imgUiArray[1] = Tools.makeBlueMask();
            //数字
            this.imgUiArray[2] = ResManager.createImage(90000062);
            this.imgUiArray[2] = Tools.makeTransparent(this.imgUiArray[2], 220);
            //边角
            this.imgUiArray[3] = ResManager.createImage(90000051);
            this.imgUiArray[3] = Tools.makeTransparent(this.imgUiArray[3], -1);
            //文字图片
            this.imgUiArray[4] = ResManager.createImage(90000043);
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
        }
        iSelectIndex = 1;
        sArray = new String[]{"免费原地复活", "回城复活", "还魂丹复活", "宠物原地复活", ""};
        startTime = System.currentTimeMillis() + 300 * 1000;
        endTime = System.currentTimeMillis();
        time = startTime - endTime;
        updateTime();
        //测试
//        initRevive(5);
    }

    public void initRevive(int level) {
        //挂机如果设置复活丹使用复活丹复活 15级免费原地复活
        if (GameBean.BL_PLAYER_HANGUP) {
            GameBean.BY_CMD_REVIVE_TYPE = 3;
            MainLogic.getInstance().send(Constant.MSG_NET_CMD_IDEAD, Constant.SOCKET_MSG_TYPE_LOGIC);

        }
        {
            this.level = level;
            if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {//战场直接复活
//            menu = new String[]{"复活", ""};
                GameBean.BY_CMD_REVIVE_TYPE = 1;
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_IDEAD, Constant.SOCKET_MSG_TYPE_LOGIC);
                GameBean.b_WAIT_NET_MSG_BACK = true;
            } else if (sRoamMapKeys.equals("10301") || sRoamMapKeys.equals("10401") || sRoamMapKeys.equals("10501")) {//副本
                menu = new String[]{"复活", "还魂丹复活", ""};
            } else {
                if (level <= 15) {//15级
                    menu = new String[]{"免费原地复活", "回城复活", "还魂丹复活", ""};
                	 
                } else {
                    menu = new String[]{"回城复活", "还魂丹复活", ""};
                }
            }
            //Yujiang
            setReviveTouchRect();
            //#if NOKIA_S60V5
             menuH = (short) (Constant.FONT_SMALL_HEIGHT + 20);
             menuSpaceH = 20;
            //#else
//#            menuH = 25;//选项高度
//#            menuSpaceH = 10;//选项间隔
            //#endif
            menuWidth = Constant.DRAW_WIDTH >> 1;
            menuHeight = (short) (menu.length * (menuH + menuSpaceH) - menuSpaceH);
            //#if NOKIA_S60V5
             iPositionY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1) + iSelectIndex * (menuH + menuSpaceH);
            //#else
//#            iPositionY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + iSelectIndex * (menuH + menuSpaceH);
            //#endif
        }
    }

    public void drawRevive(Graphics g) {
        //#if NOKIA_S60V5
         Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT - 57,
                 imgUiArray[7], 0, 0, Constant.DRAW_WIDTH, imgUiArray[7].getHeight(), Constant.TRANS_NONE);
         Tools.drawBottom(g, imgUiArray[8], imgUiArray[5], imgUiArray[6]);
        //#endif
        //绘制弹出菜单
        Tools.drawPopOperation(g, imgUiArray[3], 0x9c9c9c, 0x7c7c7c, menu,
                menuWidth, menuH, menuSpaceH, 0xFFFFFF, 0x00CCFF, (byte) iSelectIndex, 0, 0);
        //绘制选择条
        //#if NOKIA_S60V5
         //画剩余时间
         Tools.drawShadowString(g, (byte) 2, sArray[4], Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[4]) >> 1,
                 Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1) + (menu.length - 1) * (menuH + menuSpaceH) + (menuH - Constant.FONT_SMALL_HEIGHT >> 1),
                 0x00CCFF, 0x000000);
         Tools.drawSelectMask(g, (byte) 1, imgUiArray[1], Constant.UI_START_X + 0, iPositionY,
                 Constant.DRAW_WIDTH, imgUiArray[0], null, 0, 0, 0, 21, imgUiArray[4], 1, 2, 47, 21);
        //#else
//#        //画剩余时间
//#        Tools.drawShadowString(g, (byte) 2, sArray[4], Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[4]) >> 1,
//#                Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1) + (menu.length - 1) * (menuH + menuSpaceH) + (menuH - Constant.FONT_SMALL_HEIGHT >> 1),
//#                0x00CCFF, 0x000000);
//#        Tools.drawSelectMask(g, (byte) 1, imgUiArray[1], Constant.UI_START_X + 0, iPositionY,
//#                Constant.DRAW_WIDTH, imgUiArray[0], imgUiArray[4], 0, 0, 24, 12, null, 0, 0, 0, 0);
        //#endif
         //Yujiang
         if(mReviveTouchRect != null)
        	 MainView.drawTouchRect(g, mReviveTouchRect);
    }

    public void updateRevive() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            Tools.printLog("复活锁死了");
            return;
        }
        endTime = System.currentTimeMillis();
        time = startTime - endTime;
        updateTime();
        if (time <= 0) {
            GameBean.BY_CMD_REVIVE_TYPE = 1;
            MainLogic.getInstance().send(Constant.MSG_NET_CMD_IDEAD, Constant.SOCKET_MSG_TYPE_LOGIC);
            GameBean.b_WAIT_NET_MSG_BACK = true;
        }
        if (!bUiKeyPressLock) {
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                bUiKeyPressLock = true;
                iSelectIndex = iSelectIndex < (menu.length - 1) ? (iSelectIndex + 1) : 1;
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                         + iSelectIndex * (menuH + menuSpaceH);
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                        + iSelectIndex * (menuH + menuSpaceH);
                //#endif
                iArray = new int[]{1, 1, startY, 2, 50, 5};
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                bUiKeyPressLock = true;
                iSelectIndex = iSelectIndex > 1 ? (iSelectIndex - 1) : (menu.length - 1);
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                         + iSelectIndex * (menuH + menuSpaceH);
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                        + iSelectIndex * (menuH + menuSpaceH);
                //#endif
                iArray = new int[]{2, 1, startY, 2, 50, 5};
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                bUiKeyPressLock = true;
                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                    GameBean.BY_CMD_REVIVE_TYPE = 1;
                } else if (sRoamMapKeys.equals("10301") || sRoamMapKeys.equals("10401") || sRoamMapKeys.equals("10501")) {
                    switch (iSelectIndex) {
                        case 1://复活
                            GameBean.BY_CMD_REVIVE_TYPE = 1;
                            break;
                        case 2://道具复活
                            GameBean.BY_CMD_REVIVE_TYPE = 3;
                            break;
                    }
                } else {
                    if (level <= 15) {
                        switch (iSelectIndex) {
                            case 1://免费原地复活(其实就是道具复活)
                                GameBean.BY_CMD_REVIVE_TYPE = 3;
                                break;
                            case 2://回城复活
                                GameBean.BY_CMD_REVIVE_TYPE = 1;
                                break;
                            case 3://道具复活
                                GameBean.BY_CMD_REVIVE_TYPE = 3;
                                break;
                        }
                    } else {
                        switch (iSelectIndex) {
                            case 1://回城复活
                                GameBean.BY_CMD_REVIVE_TYPE = 1;
                                break;
                            case 2://道具复活
                                GameBean.BY_CMD_REVIVE_TYPE = 3;
                                break;
                        }
                    }
                }
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_IDEAD, Constant.SOCKET_MSG_TYPE_LOGIC);
                GameBean.b_WAIT_NET_MSG_BACK = true;
            }
        } else {
            iPositionY = Tools.updateLinePos(iArray, this.iPositionY);
            if (this.iArray == null || this.iArray[1] == 0) {
                this.bUiKeyPressLock = false;
            }
        }
        MainCanvas.clearInput();
    }

    public void clearRevive() {
        imgUiArray = null;
        sArray = null;
        menu = null;
    }

    public void updateTime() {
        long min = (time / 1000) / 60;
        long second = (time / 1000) % 60;
        sArray[4] = second >= 10 ? min + "：" + second : min + "：0" + second;
    }

    /*************玩家邀请切磋***************************/
    public void openContestAnswer(long lPlayerID, String mess) {
        this.sArray = new String[]{"切磋邀请", mess};
        GameBean.L_PLAYER_ID = lPlayerID;
        MainLogic.getInstance().gamePlayer.otherPlayerId = lPlayerID;
        MainLogic.getInstance().pushState(Constant.GAME_UI_CONTEST_ANSWER, true);
    }

    public void initContest() {
        //弹出层的标题
        this.iState = 1;
        try {
            //弹出层的图片数组
            // color = 0xccb5a1;
            //图片资源
            //#if NOKIA_S60V5]
             //弹出层的UI
             this.imgUiArray = new Image[6];
             //弹出层图片
             this.imgUiArray[0] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
             //背景颜色层
             this.imgUiArray[1] = Tools.makeTransparent(10, 88, 200, 0x9c9c9c);
             //确定
             this.imgUiArray[2] = ResManager.createImage(90000044);
             this.imgUiArray[3] = ResManager.createImage(90000043);//文字
             this.imgUiArray[4] = ResManager.createImage(90000086);
             this.imgUiArray[5] = ResManager.createImage(90000090);
            //#else
//#            //弹出层的UI
//#            this.imgUiArray = new Image[3];
//#            //弹出层图片
//#            this.imgUiArray[0] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
//#            //背景颜色层
//#            this.imgUiArray[1] = Tools.makeTransparent(10, 88, 200, 0x9c9c9c);
//#            //确定
//#            this.imgUiArray[2] = ResManager.createImage(90000044);
            //#endif
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
//            System.out.print("弹出层图片载入异常");
        }
    }

    public void updateContest() {
        if (this.iState < 4) {
            this.iState++;
            return;
        } else {
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                GameBean.BY_TYPE = 2;
                GameBean.BY_APPLY_RESULT = 1;
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_TRADE_ANSWER, Constant.SOCKET_MSG_TYPE_LOGIC);
                MainLogic.getInstance().gamePlayer.blPkState = true;
                Tools.printLog("同意切磋");
                MainLogic.getInstance().gamePlayer.byPlayerBigState = Constant.PLAYER_BIG_STATE_FIGHT;
                if (MainLogic.getInstance().byGameState == Constant.GAME_UI_CONTEST_ANSWER) {
                    MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                }
            } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                GameBean.BY_TYPE = 2;
                GameBean.BY_APPLY_RESULT = 0;
                MainLogic.getInstance().send(Constant.MSG_NET_CMD_TRADE_ANSWER, Constant.SOCKET_MSG_TYPE_LOGIC);
                MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
            }
        }
        MainCanvas.clearInput();
    }

    public void drawContest(Graphics g) {
        //#if NOKIA_S60V5
         Tools.drawPopUp(g, (byte) this.iState, Constant.UI_START_X + 25, Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 120) >> 1), 310, 120, this.imgUiArray[0], 0x9c9c9c, imgUiArray[2], 64, 0, 21, 10, imgUiArray[2], 43, 0, 22, 10, this.sArray[0], this.sArray[1]);
         Tools.drawBottom(g, this.imgUiArray[3], this.imgUiArray[5], this.imgUiArray[4]);
        //#else
//#        Tools.drawPopUp(g, (byte) this.iState, Constant.UI_START_X + 4, Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 80) >> 1), 232, 80, this.imgUiArray[0], this.imgUiArray[1], (byte) 1, imgUiArray[2], 43, 0, 22, 10, imgUiArray[2], 64, 0, 21, 10, this.sArray[0], this.sArray[1]);
        //#endif
    }

    public void clearContest() {
        this.sArray = null;
        this.imgUiArray = null;
    }

    /*************************附近玩家列表***************************/
    public void initNearPlayerList() {
        //#if NOKIA_S60V5
         imgUiArray = new Image[10];
         imgUiArray[7] = ResManager.createImage(90000084);//方向键
         imgUiArray[8] = ResManager.createImage(90000085);//确定键
         imgUiArray[9] = ResManager.createImage(90000086);//底部蓝条
         iPositionY = Constant.UI_START_Y + 41;
        //#else
//#        imgUiArray = new Image[7];
//#        iPositionY = Constant.UI_START_Y + 21;
        //#endif
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgUiArray[0] = ResManager.createImage(90000017);
//# //            imgUiArray[0] = Tools.ZoomImage(imgUiArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
        imgUiArray[0] = ResManager.createImage(90000017);//背景图片
        //#endif
        imgUiArray[1] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 100, 0x252525);//半透明背景图片
        imgUiArray[2] = ResManager.createImage(90000041);//箭头图片
        imgUiArray[3] = Tools.makeBlueMask();//蓝光图片
        imgUiArray[4] = ResManager.createImage(90000043);//确定、返回图片
        //弹出层图片
        imgUiArray[5] = Tools.makeTransparent(ResManager.createImage(90000051), -1);//菜单背景图片
        imgUiArray[6] = ResManager.createImage(90000047);//数字图片
        bUiKeyPressLock = false;
        byUiState = 0;
        iSelectIndex = 1;
        shCurrentPage = 1;
        //#if NOKIA_E72
//#         byMaxNum = 5;
        //#else
        byMaxNum = 10;
        //#endif

        sArray = new String[]{"附近玩家", "职业  ", "等级  ", "姓名  ", "【武师】19 - 测试姓名长度",// 0 - 4
            "确定", "返回" // 5 - 6
        };
        //测试
//        getNearPlayerListNum((short) 0);
//        for (int i = 0; i < 0; i++) {
//            getNearPlayerList(i, i, (byte) 1, i, "玩家名字长度");
//        }
    }

    public void getNearPlayerListNum(short num) {
        playerNum = num;
        sData = new String[num][2];
        playerId = new long[num];
        playerName = new String[num];
        otherPlayerLv = new short[num];
        if (num == 0) {
            bySelectNum = 1;
            shTotalePage = 1;
        } else {
            bySelectNum = (byte) (num >= byMaxNum + 1 ? byMaxNum + 1 : num + 1);
            shTotalePage = (short) (num % (bySelectNum - 1) == 0 ? num / (bySelectNum - 1) : num / (bySelectNum - 1) + 1);
        }
        /////////
        //Yujiang
        setNearPlayerListTouchRect();
    }

    public void getNearPlayerList(int index, long id, byte duty, int lv, String name) {
        sData[index][0] = "【" + Tools.getJobName(duty) + "】";
        otherPlayerLv[index] = (short) lv;
        sData[index][1] = lv > 9 ? lv + " - " + name : "0" + lv + " - " + name;
        playerId[index] = id;
        playerName[index] = name;
    }

    public void updateNearPlayerList() {
        if (!bUiKeyPressLock) {
            switch (byUiState) {
                case 0:
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 1) {
                            if (bySelectNum > 1) {
                                iSelectIndex = bySelectNum;
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + (41 << 1)
                                         + ((Constant.END_LINE - (41 << 1)) / byMaxNum) * (iSelectIndex - 2);
                                //#else
//#                                startY = Constant.UI_START_Y + 70 + (Constant.FONT_SMALL_HEIGHT + 1) * (iSelectIndex - 2);
                                //#endif
                            } else {
                                return;
                            }
                        } else if (iSelectIndex == bySelectNum) {
                            iSelectIndex--;
                            if (bySelectNum > 2) {
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + (41 << 1)
                                         + ((Constant.END_LINE - (41 << 1)) / byMaxNum) * (iSelectIndex - 2);
                                //#else
//#                                startY = Constant.UI_START_Y + 70 + (Constant.FONT_SMALL_HEIGHT + 1) * (iSelectIndex - 2);
                                //#endif
                            } else {
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + 41;
                                //#else
//#                                startY = Constant.UI_START_Y + 21;
                                //#endif
                            }
                        } else {
                            iSelectIndex--;
                            if (iSelectIndex == 1) {
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + 41;
                                //#else
//#                                startY = Constant.UI_START_Y + 21;
                                //#endif
                            } else {
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + (41 << 1)
                                         + ((Constant.END_LINE - (41 << 1)) / byMaxNum) * (iSelectIndex - 2);
                                //#else
//#                                startY = Constant.UI_START_Y + 70 + (Constant.FONT_SMALL_HEIGHT + 1) * (iSelectIndex - 2);
                                //#endif
                            }
                        }
                        iArray = new int[]{2, 1, startY, 2, 50, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex == 1) {
                            if (bySelectNum > 1) {
                                iSelectIndex++;
                                //#if NOKIA_S60V5
                                 startY = Constant.UI_START_Y + (41 << 1)
                                         + ((Constant.END_LINE - (41 << 1)) / byMaxNum) * (iSelectIndex - 2);
                                //#else
//#                                startY = Constant.UI_START_Y + 70 + (Constant.FONT_SMALL_HEIGHT + 1) * (iSelectIndex - 2);
                                //#endif
                            } else {
                                return;
                            }
                        } else if (iSelectIndex == bySelectNum) {
                            iSelectIndex = 1;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + 41;
                            //#else
//#                            startY = Constant.UI_START_Y + 21;
                            //#endif
                        } else {
                            iSelectIndex++;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (41 << 1)
                                     + ((Constant.END_LINE - (41 << 1)) / byMaxNum) * (iSelectIndex - 2);
                            //#else
//#                            startY = Constant.UI_START_Y + 70 + (Constant.FONT_SMALL_HEIGHT + 1) * (iSelectIndex - 2);
                            //#endif
                        }
                        iArray = new int[]{1, 1, startY, 2, 50, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                        bUiKeyPressLock = true;
                        if (shCurrentPage > 1) {
                            shCurrentPage--;
                            bySelectNum = (byte) (shCurrentPage * byMaxNum < playerNum ? byMaxNum + 1 : playerNum - (shCurrentPage - 1) * byMaxNum + 1);
                            iSelectIndex = 1;
                            //#if NOKIA_S60V5
                             iPositionY = Constant.UI_START_Y + 41;
                            //#else
//#                            iPositionY = Constant.UI_START_Y + 21;
                            //#endif
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                        bUiKeyPressLock = true;
                        if (shTotalePage > shCurrentPage) {
                            shCurrentPage++;
                            bySelectNum = (byte) (shCurrentPage * byMaxNum < playerNum ? byMaxNum + 1 : playerNum - (shCurrentPage - 1) * byMaxNum + 1);
                            iSelectIndex = 1;
                            //#if NOKIA_S60V5
                             iPositionY = Constant.UI_START_Y + 41;
                            //#else
//#                            iPositionY = Constant.UI_START_Y + 21;
                            //#endif
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                        bUiKeyPressLock = true;
                        if (iSelectIndex > 1) {
                            byUiState = 1;
                            menu = new String[]{"1 私聊", "2 组队", "3 交易", "4 观察", "5 切磋", "6 交友", "7 邀请入帮"};
                            menuSelectIndex = 4;
                            //#if NOKIA_S60V5
                             menuH = (short) ((Constant.END_LINE - (41 << 1)) / byMaxNum);
                            //#else
//#                            menuH = (short) (Constant.FONT_SMALL_HEIGHT + 2);
                            //#endif
                            menuSpaceH = 10;
                            menuWidth = Constant.DRAW_WIDTH >> 1;
                            menuHeight = (short) (menu.length * (menuH + menuSpaceH) - menuSpaceH);
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{1, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回上一界面
                        Tools.openRoamMenu(false, (byte) 1, (byte) 8, 2);
                    }
                    break;
                case 1:
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        menuSelectIndex = (byte) (menuSelectIndex == 1 ? menu.length : (menuSelectIndex - 1));
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                 + menuSelectIndex * (menuH + menuSpaceH);
                        //#else
//#                        startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                + menuSelectIndex * (menuH + menuSpaceH);
                        //#endif
                        iArray = new int[]{2, 1, startY, 2, 50, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        menuSelectIndex = (byte) (menuSelectIndex == menu.length ? 1 : (menuSelectIndex + 1));
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                 + menuSelectIndex * (menuH + menuSpaceH);
                        //#else
//#                        startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                + menuSelectIndex * (menuH + menuSpaceH);
                        //#endif
                        iArray = new int[]{1, 1, startY, 2, 50, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {
                        bUiKeyPressLock = true;
                        int tempIndex = (shCurrentPage - 1) * byMaxNum + iSelectIndex - 2;
                        switch (menuSelectIndex) {
                            case 1://私聊
                                GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_NEAR_PLAYER_LIST;
                                GameBean.BY_CMD_FRIEND_TYPE = 1;
                                GameBean.L_PLAYER_ID = playerId[tempIndex];
                                UiEquipment.chatOtherplayerId = playerId[tempIndex];//发送对象Id
                                MainLogic.getInstance().uiEquipment.chatOtherplayerName = playerName[tempIndex];
                                if (MainLogic.getInstance().uiEquipment.chatOtherplayerName.equals(MainLogic.getInstance().gamePlayer.sPlayerName)) {
                                    MainLogic.getInstance().uiEquipment.chatOtherplayerName = "";
                                }
                                MainLogic.getInstance().uiEquipment.chatshoutType = 3;
                                MainLogic.getInstance().pushState(Constant.GAME_UI_CHAT, true);
                                MainLogic.getInstance().inputInterFace.setInputInterFace(Constant.GAME_UI_CHAT, "私聊发送聊天");
                                MainLogic.getInstance().inputInterFace.commonInput.setString(null);
                                MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                                break;
                            case 2://组队
                                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                                    sysMessage.showMessage("提示", "战场中不允许组队!", (byte) 1, (byte) -1);
                                } else if (sRoamMapKeys.equals("10301")
                                        || sRoamMapKeys.equals("10401")
                                        || sRoamMapKeys.equals("10501")) {//副本
                                    sysMessage.showMessage("提示", "副本中不允许组队!", (byte) 1, (byte) -1);
                                } else {
                                    GameBean.L_PLAYER_ID = playerId[tempIndex];
                                    if (team.getTeamMemberNum() <= 0) {
                                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_TEAM_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                                        sysMessage.showMessage("提示", "请求已经发出!", (byte) 1, (byte) -1);
                                        byUiState = 0;
                                    } else if (team.getTeamMemberNum() < Constant.MAX_TEAM_MEMBER_NUM) {
                                        if (team.getMemberPos(GameBean.L_PLAYER_ID) != -1) {
                                            sysMessage.showMessage("提示", "该玩家已在您的队伍中!", (byte) 1, (byte) -1);
                                        } else if (!team.isMeLeader()) {
                                            sysMessage.showMessage("提示", "只有队长才能邀请玩家入队!", (byte) 1, (byte) -1);
                                        } else {
                                            MainLogic.getInstance().send(Constant.MSG_NET_CMD_TEAM_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                                            sysMessage.showMessage("提示", "请求已经发出!", (byte) 1, (byte) -1);
                                            byUiState = 0;
                                        }
                                    } else {
                                        sysMessage.showMessage("提示", "队伍人数已满!", (byte) 1, (byte) -1);
                                    }
                                }
                                break;
                            case 3://交易
                                GameBean.L_PLAYER_ID = playerId[tempIndex];
                                GameBean.BY_TYPE = 1;//(1,交易,2:切磋)
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_TRADE_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                                MainLogic.uiInterFace.sysMessage.showMessage("提示", "交易请求已发出!", (byte) 1, (byte) -1);
                                byUiState = 0;
                                break;
                            case 4://观察
                                GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_NEAR_PLAYER_LIST;
                                GameBean.L_PLAYER_ID = playerId[tempIndex];
                                MainLogic.getInstance().send(Constant.MSG_NET_CMD_OTHER_PLAYER_DETAIL, Constant.SOCKET_MSG_TYPE_LOGIC);
                                break;
                            case 5://切磋
                                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                                    sysMessage.showMessage("提示", "战场中不允许切磋!", (byte) 1, (byte) -1);
                                } else {
                                    GameBean.L_PLAYER_ID = playerId[tempIndex];
                                    MainLogic.getInstance().gamePlayer.otherPlayerId = GameBean.L_PLAYER_ID;
                                    GameBean.BY_TYPE = 2;//(1,交易,2:切磋)
                                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_TRADE_JOIN, Constant.SOCKET_MSG_TYPE_LOGIC);
                                    MainLogic.uiInterFace.sysMessage.showMessage("提示", "已向对方发出了切磋请求!", (byte) 1, (byte) -1);
                                    MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                                }
                                break;
                            case 6://交友
                                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                                    sysMessage.showMessage("提示", "战场中不允许添加好友!", (byte) 1, (byte) -1);
                                } else {
                                    GameBean.BY_CMD_FRIEND_NAME = playerName[tempIndex];
                                    GameBean.BY_CMD_FRIEND_TYPE = 1;
                                    GameBean.BY_CMD_FRIEND_MODE = 1;
                                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_ADD_FRIEND, Constant.SOCKET_MSG_TYPE_LOGIC);
                                    GameBean.b_WAIT_NET_MSG_BACK = true;
                                    byUiState = 0;
                                }
                                break;
                            case 7://邀请入帮
                                if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
                                    sysMessage.showMessage("提示", "对方已有帮派!", (byte) 1, (byte) -1);
                                } else {
                                    if (MainLogic.getInstance().gamePlayer.sTongName == null) {
                                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您没有邀请其他玩家加入帮派的权限!", (byte) 1, (byte) -1);
                                    } else if (otherPlayerLv[tempIndex] < 20) {
                                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您没有邀请其他玩家加入帮派的权限!", (byte) 1, (byte) -1);
                                    } else {
                                        GameBean.L_PLAYER_ID = playerId[tempIndex];
                                        GameBean.BY_CMD_INVITE_TONG_TYPE = 1;
                                        MainLogic.getInstance().send(Constant.MSG_NET_INVITE_TONG, Constant.SOCKET_MSG_TYPE_LOGIC);
                                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "请求已经发出!", (byte) 1, (byte) -1);
                                    }
                                    byUiState = 0;
                                }
                                break;
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false)) {//私聊
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 1) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 1 ? 2 : 1;
                            menuSelectIndex = 1;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false)) {//组队
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 2) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 2 ? 2 : 1;
                            menuSelectIndex = 2;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_3, false)) {//交易
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 3) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 3 ? 2 : 1;
                            menuSelectIndex = 3;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_4, false)) {//观察
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 4) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 4 ? 2 : 1;
                            menuSelectIndex = 4;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {//切磋
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 5) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 5 ? 2 : 1;
                            menuSelectIndex = 5;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_6, false)) {//交友
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 6) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 6 ? 2 : 1;
                            menuSelectIndex = 6;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_7, false)) {//邀请入帮
                        bUiKeyPressLock = true;
                        if (menuSelectIndex == 7) {
                            break;
                        } else {
                            int temp = menuSelectIndex > 7 ? 2 : 1;
                            menuSelectIndex = 7;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + (Constant.END_LINE - menuHeight >> 1)
                                     + menuSelectIndex * (menuH + menuSpaceH);
                            //#else
//#                            startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - menuHeight >> 1)
//#                                    + menuSelectIndex * (menuH + menuSpaceH);
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回上一层菜单
                        bUiKeyPressLock = true;
                        byUiState = 0;
                    }
                    break;
            }
        } else {
            switch (byUiState) {
                case 0:
                    iPositionY = Tools.updateLinePos(iArray, iPositionY);
                    break;
                case 1:
                    menuPositionY = Tools.updateLinePos(iArray, menuPositionY);
                    break;
            }
            if (iArray == null || iArray[1] == 0) {
                bUiKeyPressLock = false;
            }
        }
    }

    public void drawNearPlayerList(Graphics g) {
        int w = 0;
        int h = 0;
        int blackColor = 0x000000;
        int whiteColor = 0xFFFFFF;
        int selectColor = 0x00CCFF;
        //绘制背景
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[7], imgUiArray[8], imgUiArray[9], imgUiArray[4], sArray[0]);
         h = 41;
         startY = Constant.UI_START_Y + 41 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#else
//#        h = imgUiArray[4].getHeight();
//#        Tools.drawFrame(g, imgUiArray[0], imgUiArray[3], sArray[5], sArray[6], sArray[0]);
//#        h = 30;
//#        startY = Constant.UI_START_Y + 21 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
        //#endif
        //绘制职业、等级、姓名提示
        w = Constant.FONT_SMALL.stringWidth(sArray[1] + sArray[2] + sArray[3]);
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
        Tools.drawShadowString(g, (byte) 1, sArray[1] + sArray[2] + sArray[3], startX, startY, selectColor, blackColor);
        //绘制提示两边箭头
        startX = Constant.UI_START_X + 15;
        startY = startY + (Constant.FONT_SMALL_HEIGHT - 7 >> 1);//7为箭头高度
        Tools.drawArrow(g, imgUiArray[2], (byte) 1, startX, startY);
        startX = Constant.UI_START_X + Constant.DRAW_WIDTH - 15 - 5;//5为箭头宽度
        Tools.drawArrow(g, imgUiArray[2], (byte) 2, startX, startY);
        //绘制提示选择条
        startX = Constant.UI_START_X + 0;
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + 41 + h;
        //#else
//#        startY = Constant.UI_START_Y + 21 + h;
        //#endif
        w = Constant.DRAW_WIDTH;
        //Yujiang
       // Tools.drawSelectMask(g, (byte) 1, imgUiArray[3], startX, startY, w);
        //绘制半透明背景
        //#if NOKIA_S60V5
         h = Constant.END_LINE - startY;
        //#else
//#        h = Constant.DRAW_HEIGHT - startY - 25;//25为底层高度
        //#endif
        Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[1], 0, 0, w, imgUiArray[1].getHeight(), Constant.TRANS_NONE);
        //绘制列表
        w = Constant.FONT_SMALL.stringWidth(sArray[4]);
        //#if NOKIA_S60V5
         h = h / byMaxNum;
        //#else
//#        h = Constant.FONT_SMALL_HEIGHT + 1;
        //#endif
        int temp = (shCurrentPage * byMaxNum < playerNum) ? shCurrentPage * byMaxNum : playerNum;
        for (int i = (shCurrentPage - 1) * byMaxNum; i < temp; i++) {
            startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
            //#if NOKIA_S60V5
             startY = Constant.UI_START_Y + (41 << 1) + (h - Constant.FONT_SMALL_HEIGHT >> 1)
                     + h * (i - (shCurrentPage - 1) * byMaxNum);
            //#else
//#            startY = Constant.UI_START_Y + 70 + h * (i - (shCurrentPage - 1) * byMaxNum);
            //#endif
            Tools.drawShadowString(g, (byte) 1, sData[i][0], startX, startY, selectColor, blackColor);
            startX = startX + Constant.FONT_SMALL.stringWidth(sData[i][0]);
            Tools.drawShadowString(g, (byte) 1, sData[i][1], startX, startY, whiteColor, blackColor);
        }
        //绘制翻页
        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Tools.getPageStrWidth(shTotalePage, shCurrentPage) >> 1);
        //#if NOKIA_S60V5
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 57 + (57 - imgUiArray[6].getHeight() >> 1);
        //#else
//#        startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 25 + (25 - imgUiArray[6].getHeight() >> 1);
        //#endif
        Tools.drawPage(g, shTotalePage, shCurrentPage, imgUiArray[6], imgUiArray[2], startX, startY);
        //绘制选择条
        startX = Constant.UI_START_X + 0;
        w = Constant.DRAW_WIDTH;
        if (iSelectIndex == 1) {
        	 //Yujiang
//            Tools.drawSelectMask(g, (byte) 2, imgUiArray[3], startX, iPositionY, w);
        } //        else if (iSelectIndex == bySelectNum) {
        //            Tools.drawSelectMask(g, (byte) 1, imgUiArray[3], startX, iPositionY, w);
        //        } 
        else {
            //#if NOKIA_S60V5
             h = (Constant.END_LINE - (41 << 1)) / byMaxNum;
            //#else
//#            h = Constant.FONT_SMALL_HEIGHT + 1;
            //#endif
             //Yujiang
         //   Tools.drawGapSlectMask(g, imgUiArray[3], null, false, h, startX, iPositionY, w);
        }
        if (byUiState == 1) {//弹出菜单
            startX = Constant.UI_START_X + 0;
            startY = Constant.UI_START_Y + 0;
            w = Constant.DRAW_WIDTH;
            //#if NOKIA_S60V5
             h = Constant.END_LINE;
            //#else
//#            h = Constant.DRAW_HEIGHT;
            //#endif
            //背景遮罩
            Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[1], 0, 0, w, imgUiArray[1].getHeight(), Constant.TRANS_NONE);
            //弹出菜单
            Tools.drawPopOperation(g, imgUiArray[5], 0x989898, 0x7c7c7c, menu, menuWidth, menuH,
                    menuSpaceH, whiteColor, selectColor, menuSelectIndex, 0, 0);
            
            
           
            
            //绘制选择条
            startX = Constant.UI_START_X + 0;
            w = Constant.DRAW_WIDTH;
            //#if NOKIA_S60V5
            //Yujiang
            // Tools.drawSelectMask(g, (byte) 1, imgUiArray[3], startX, menuPositionY, w, imgUiArray[2],
//                     imgUiArray[4], 1, 2, 47, 21, imgUiArray[4], 100, 3, 45, 20);
            //#else
//#            h = imgUiArray[4].getHeight();
//#            Tools.drawSelectMask(g, (byte) 1, imgUiArray[3], startX, menuPositionY, w, imgUiArray[2],
//#                    imgUiArray[4], 0, 0, 24, h, imgUiArray[4], 49, 0, 23, h);
            //#endif
        }
        
        ///////////////
        //Yujiang
        if(mNearPlayerListTouchRect != null)
        	MainView.drawTouchRect(g, mNearPlayerListTouchRect);
        
    }

    public void clearNearPlayerList() {
        imgUiArray = null;
        sArray = null;
        sData = null;
        otherPlayerLv = null;
    }
//    //新手引导开始
//    public String[] strNewPlayer;
//    public static boolean isopenNewPlayer;
//    public static String struseitemKey, strgetitemKey;
//    public static boolean issendgetItem = false;
//    public static boolean[] overNewPlayer = {
//        false, false, false, false, false,//
//        false, false, false, false, false,//
//        false, false, false, false, false,//
//        false,//
//    };
//    public static boolean[] overnewPlayer_1, overnewPlayer_2, overnewPlayer_3, overnewPlayer_4;
//
//    public boolean updateNewPlayer(int id) {
//        boolean isover = false;
//        isover = true;
//        overNewPlayer[id] = true;
//        Tools.printLog("引导：：：：" + id);
//        switch (Constant.PLAYER_INDEX) {
//            case 1:
//                overnewPlayer_1 = new boolean[overNewPlayer.length];
//                for (int i = 0; i < overNewPlayer.length; i++) {
//                    overnewPlayer_1[i] = overNewPlayer[i];
//                }
//                Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_1, null);
//                break;
//            case 2:
//                overnewPlayer_2 = new boolean[overNewPlayer.length];
//                for (int i = 0; i < overNewPlayer.length; i++) {
//                    overnewPlayer_2[i] = overNewPlayer[i];
//                }
//                Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_2, null);
//                break;
//            case 3:
//                overnewPlayer_3 = new boolean[overNewPlayer.length];
//                for (int i = 0; i < overNewPlayer.length; i++) {
//                    overnewPlayer_3[i] = overNewPlayer[i];
//                }
//                Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_3, null);
//                break;
//            case 4:
//                overnewPlayer_4 = new boolean[overNewPlayer.length];
//                for (int i = 0; i < overNewPlayer.length; i++) {
//                    overnewPlayer_4[i] = overNewPlayer[i];
//                }
//                Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_4, null);
//                break;
//        }
//        return isover;
//    }
    //新手引导结束
    /************************绘制各种天气效果***************************************************/
    private static int effect_index;
    public static Image[] effectImg = null; //天气效果图片
    private int[] cloud;

    /**
     * 初始化天气资源
     */
    public byte getScenceWeatherType(String scenceKey) {
        if (this.sRoamMapKeys.substring(0, 4).equals("1004")
                || this.sRoamMapKeys.substring(0, 4).equals("1020")) {
            return 1;
        } else if (this.sRoamMapKeys.substring(0, 4).equals("1002")
                || this.sRoamMapKeys.substring(0, 4).equals("1003")
                //                || this.sRoamMapKeys.substring(0, 4).equals("1010")
                //                || this.sRoamMapKeys.substring(0, 4).equals("1020")
                || this.sRoamMapKeys.substring(0, 4).equals("1060")) {
            return 2;
        } else if (this.sRoamMapKeys.substring(0, 4).equals("1006")
                || this.sRoamMapKeys.substring(0, 4).equals("1007")
                || this.sRoamMapKeys.substring(0, 4).equals("1008")) {
            return 3;
        } else if (this.sRoamMapKeys.substring(0, 4).equals("1009")
                || this.sRoamMapKeys.substring(0, 4).equals("1010")) {
            return 4;
        }
        return -1;
    }

    public void initWeather() {
        switch (this.byWeatherType) {
            case 1:
                initSnow();
                break;
            case 2:
                initSunshine();
                break;
            case 3:
                initPetals();
                break;
            case 4:
                initRain();
                break;
            case 5:
                this.initCloud();
                break;
        }

    }

    /**
     * 绘制天气效果
     * @param g 
     */
    public void drawWeather(Graphics g) {
        //绘制天气效果
        switch (this.byWeatherType) {
            case 1:
                this.drawBackSnow(g);
                break;
            case 2:
                this.drawSunshine(g);
                break;
            case 3:
                this.drawPetals(g);
                break;
            case 4:
                this.drawRain(g);
                break;
            case 5:
                this.drawCloud(g);
                break;
        }
    }

    /**
     * 清除天气的资源
     */
    public void clearWeatherRes() {
        this.cloud = null;
        rainArray = null;
        petalsX = null;
        petalsY = null;
        snowX = null;
        snowY = null;
    }

    /**
     * 绘制阳光效果
     */
    public void initSunshine() {//ffffcc
        effect_index = 0;
        this.effectImg = new Image[3];
        try {
            this.effectImg[0] = Tools.createPicFromGrayscale(ResManager.createImage(90000031), 0xffffcc);
            this.effectImg[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000032), 0xffffcc);
            this.effectImg[2] = Tools.createPicFromGrayscale(ResManager.createImage(90000033), 0xffffcc);
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
        }
    }

    public void drawSunshine(Graphics g) {
        int SunY0 = 0, SunY1 = 0, SunY2 = 0;
        effect_index++;
        SunY0 = (Tools.sin(effect_index << Tools.BITS + 3) >> Tools.BITS - 2);
        SunY1 = (Tools.sin(effect_index << Tools.BITS + 3) >> Tools.BITS - 3);
        SunY2 = (Tools.sin(effect_index << Tools.BITS + 4) >> Tools.BITS - 2);
        if (effectImg != null) {
            g.drawImage(effectImg[0], 0, SunY0 - 16 - 27, g.LEFT | g.TOP);
            g.drawImage(effectImg[1], 0, -SunY1 - 16, g.LEFT | g.TOP);
            g.drawImage(effectImg[0], 0, SunY0, g.LEFT | g.TOP);
            g.drawImage(effectImg[1], 0, SunY1 + 27, g.LEFT | g.TOP);
            g.drawImage(effectImg[0], -10, -SunY0 + 27, g.LEFT | g.TOP);
            g.drawImage(effectImg[2], 0, SunY2 + 27 * 2 + 10, g.LEFT | g.TOP);
        }

    }

    /**
     * 云效果
     */
    public void initCloud() {//ffffcc
        this.cloud = new int[]{-120, -240, -360, -420, -480, -600, -660, -120, -180, -240, -360, -480, -540, -660, 720, 900, 960, 1020, 1140, 1200, 1320,};
        this.effectImg = new Image[1];
        try {
            this.effectImg[0] = ResManager.createImage(90000074);
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
        }
    }

    public void drawCloud(Graphics g) {
        int map_shAreaW = MainLogic.getInstance().gameMap.shAreaW;
        int Map_ViewOffsetX = MainLogic.getInstance().gameMap.iMapViewOffsetX;
        int Map_ViewOffsetY = MainLogic.getInstance().gameMap.iMapViewOffsetY;
        cloud[0] += 1;
        cloud[1] += 1;
        cloud[2] += 1;
        cloud[3] += 1;
        cloud[4] += 1;
        cloud[5] += 1;
        cloud[6] += 1;
        //
        cloud[7] += 1;
        cloud[8] += 1;
        cloud[9] += 1;
        cloud[10] += 1;
        cloud[11] += 1;
        cloud[12] += 1;
        cloud[13] += 1;
        //
        cloud[14] -= 1;
        cloud[15] -= 1;
        cloud[16] -= 1;
        cloud[17] -= 1;
        cloud[18] -= 1;
        cloud[19] -= 1;
        cloud[20] -= 1;
        if (this.effectImg[0] != null) {
            g.drawImage(this.effectImg[0], cloud[0] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 40 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[1] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 20 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[2] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 30 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[3] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 40 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[4] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 20 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[5] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 30 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[6] - Map_ViewOffsetX, Constant.DRAW_HEIGHT - this.effectImg[0].getHeight() - 30 - Map_ViewOffsetY, 0);
            //
            g.drawImage(this.effectImg[0], cloud[7] - Map_ViewOffsetX, (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[8] - Map_ViewOffsetX, 20 - Map_ViewOffsetY + (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2, 0);
            g.drawImage(this.effectImg[0], cloud[9] - Map_ViewOffsetX, 30 - (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[10] - Map_ViewOffsetX, 20 - Map_ViewOffsetY + (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2, 0);
            g.drawImage(this.effectImg[0], cloud[11] - Map_ViewOffsetX, (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[12] - Map_ViewOffsetX, 30 - Map_ViewOffsetY + (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2, 0);
            g.drawImage(this.effectImg[0], cloud[13] - Map_ViewOffsetX, (Constant.DRAW_HEIGHT - this.effectImg[0].getHeight()) / 2 - Map_ViewOffsetY, 0);
            //
            g.drawImage(this.effectImg[0], cloud[14] - Map_ViewOffsetX, 10 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[15] - Map_ViewOffsetX, 20 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[16] - Map_ViewOffsetX, 30 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[17] - Map_ViewOffsetX, 20 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[18] - Map_ViewOffsetX, 30 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[19] - Map_ViewOffsetX, 10 - Map_ViewOffsetY, 0);
            g.drawImage(this.effectImg[0], cloud[20] - Map_ViewOffsetX, 20 - Map_ViewOffsetY, 0);
        }
        //-120, -240, -360, -420, -480, -600, -660,
        if (cloud[0] > map_shAreaW) {
            cloud[0] = -120;
        }
        if (cloud[1] > map_shAreaW) {
            cloud[1] = -240;
        }
        if (cloud[2] > map_shAreaW) {
            cloud[2] = -360;
        }
        if (cloud[3] > map_shAreaW) {
            cloud[3] = -420;
        }
        if (cloud[4] > map_shAreaW) {
            cloud[4] = -480;
        }
        if (cloud[5] > map_shAreaW) {
            cloud[5] = -600;
        }
        if (cloud[6] > map_shAreaW) {
            cloud[6] = -660;
        }
        //-120, -180, -240, -360, -480, -540, -660
        if (cloud[7] > map_shAreaW) {
            cloud[7] = -120;
        }
        if (cloud[8] > map_shAreaW) {
            cloud[8] = -180;
        }
        if (cloud[9] > map_shAreaW) {
            cloud[9] = -240;
        }
        if (cloud[10] > map_shAreaW) {
            cloud[10] = -360;
        }
        if (cloud[11] > map_shAreaW) {
            cloud[11] = -480;
        }
        if (cloud[12] > map_shAreaW) {
            cloud[12] = -540;
        }
        if (cloud[13] > map_shAreaW) {
            cloud[13] = -660;
        }
        //720, 900, 960, 1020, 1140, 1200, 1320
        if (cloud[14] < -125) {
            cloud[14] = map_shAreaW;
        }
        if (cloud[15] < -125) {
            cloud[15] = map_shAreaW + 180;
        }
        if (cloud[16] < -125) {
            cloud[16] = map_shAreaW + 240;
        }
        if (cloud[17] < -125) {
            cloud[17] = map_shAreaW + 300;
        }
        if (cloud[18] < -125) {
            cloud[18] = map_shAreaW + 420;
        }
        if (cloud[19] < -125) {
            cloud[19] = map_shAreaW + 480;
        }
        if (cloud[20] < -125) {
            cloud[20] = map_shAreaW + 600;
        }
    }
    /**
     * 绘制下雨效果
     */
    int rain;
    int[][] rainArray;//x,y,endx,endy,type,time;
    public static int rain_index;

    public void initRain() {
        rand = new Random();
        rain = 220;
        rain_index = 0;
        rainArray = new int[rain][6];
        for (int i = 0; i < rain; i++) {
            rainArray[i][0] = -Math.abs(rand.nextInt() % Constant.DRAW_WIDTH);  //
            rainArray[i][1] = -Math.abs(rand.nextInt() % Constant.DRAW_HEIGHT); //
            rainArray[i][2] = Math.abs(rand.nextInt() % Constant.DRAW_WIDTH);  //
            rainArray[i][3] = Math.abs(rand.nextInt() % Constant.DRAW_HEIGHT); //
            rainArray[i][4] = 0;
            rainArray[i][5] = 0;
        }
    }

    public void drawRain(Graphics g) {
        for (int i = 0; i < rain; i++) {
            if (rainArray[i][4] == 0) {
                g.setColor(0x669999);
                g.drawLine(rainArray[i][0], rainArray[i][1], rainArray[i][0] + 3, rainArray[i][1] + 3);
                rainArray[i][0] += 12;
                rainArray[i][1] += 16;
                if (rainArray[i][0] >= rainArray[i][2] && rainArray[i][1] >= rainArray[i][3]) {
                    rainArray[i][4] = 1;
                }
            } else if (rainArray[i][4] == 1) {
                for (int j = 0; j < 4; j++) {
                    int tmpX = getDisEffect(rainArray[i][0], rainArray[i][1])[rainArray[i][5]][j][0];
                    int tmpY = getDisEffect(rainArray[i][0], rainArray[i][1])[rainArray[i][5]][j][1];
                    g.setColor(getDisEffect(rainArray[i][0], rainArray[i][1])[rainArray[i][5]][4][0]);
                    g.drawLine(tmpX, tmpY, tmpX, tmpY);
                }
                if (rain_index % 2 == 0) {
                    rainArray[i][5]++;
                    if (rainArray[i][5] > 2) {
                        rainArray[i][4] = 2;
                    }
                }
            } else if (rainArray[i][4] == 2) {
                rainArray[i][0] = -Math.abs(rand.nextInt() % Constant.DRAW_WIDTH);  //
                rainArray[i][1] = -Math.abs(rand.nextInt() % Constant.DRAW_HEIGHT); //
                rainArray[i][2] = Math.abs(rand.nextInt() % Constant.DRAW_WIDTH);  //
                rainArray[i][3] = Math.abs(rand.nextInt() % Constant.DRAW_HEIGHT); //
                rainArray[i][4] = 0;
                rainArray[i][5] = 0;
            }
        }
        rain_index++;
    }

    public final int[][][] getDisEffect(int x, int y) {
        return new int[][][]{
                    {//0
                        {x - 1, y - 1},//UP
                        {x, y - 1},//RIGHT
                        {x - 1, y},//LEFT
                        {x, y},//DOWN
                        {0xff99cccc},},
                    {//1
                        {x - 2, y - 1 - 2},//UP
                        {x + 2, y - 1 - 2},//RIGHT
                        {x - 2, y + 1 - 2},//LEFT
                        {x + 2, y + 1 - 2},//DOWN
                        {0xff99cccc},},
                    {//2
                        {x - 3, y - 2},//UP
                        {x + 3, y - 2},//RIGHT
                        {x - 4, y + 2},//LEFT
                        {x + 4, y + 2},//DOWN
                        {0xff9A9A9C},},};
    }
    /**
     * 绘制花瓣效果petals
     */
    int petals;
    int[] petalsX, petalsY;
    public static int petalsindex;

    public void initPetals() {
        rand = new Random();
        petals = 14;
        petalsindex = 0;
        this.effectImg = new Image[1];
        try {
            //头像
            this.effectImg[0] = ResManager.createImage(90000040);
        } catch (Exception e) {
            e.printStackTrace();
        }
        petalsX = new int[petals];
        petalsY = new int[petals];
        for (int i = 0; i < petals; i++) {
            petalsX[i] = rand.nextInt() % (Constant.DRAW_WIDTH / 2) + Constant.DRAW_WIDTH / 2;  //
            petalsY[i] = rand.nextInt() % (Constant.DRAW_HEIGHT / 2) + Constant.DRAW_HEIGHT / 2;  // 
        }
    }

    /**
     * 清除天气的资源
     */
    public void drawPetals(Graphics g) {
        petalsindex++;
        g.setColor(0xffffff);
        for (int i = 0; i < petals; i++) {
            if (i % 3 == 0) {
                if (petalsindex % 3 == 0) {
                    g.drawRegion(this.effectImg[0], 20, 0, 10, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                } else if (petalsindex % 3 == 1) {
                    g.drawRegion(this.effectImg[0], 0, 0, 8, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                } else if (petalsindex % 3 == 2) {
                    g.drawRegion(this.effectImg[0], 9, 0, 11, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                }
            } else if (i % 3 == 1) {
                if (petalsindex % 3 == 0) {
                    g.drawRegion(this.effectImg[0], 9, 0, 11, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                } else if (petalsindex % 3 == 1) {
                    g.drawRegion(this.effectImg[0], 20, 0, 10, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                } else if (petalsindex % 3 == 2) {
                    g.drawRegion(this.effectImg[0], 0, 0, 8, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                }
            } else if (i % 3 == 2) {
                if (petalsindex % 3 == 0) {
                    g.drawRegion(this.effectImg[0], 0, 0, 8, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                } else if (petalsindex % 3 == 1) {
                    g.drawRegion(this.effectImg[0], 9, 0, 11, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                } else if (petalsindex % 3 == 2) {
                    g.drawRegion(this.effectImg[0], 20, 0, 10, 12, Constant.TRANS_NONE, petalsX[i], petalsY[i], g.TOP | g.LEFT);
                }
            }
            if (i < 6) {
                petalsX[i] += Math.abs(rand.nextInt() % 2) + 4;
                petalsY[i] += Math.abs(rand.nextInt() % 2) + 1;
            } else {
                petalsX[i] += rand.nextInt() % 4 + 1;
                petalsY[i] += Math.abs(rand.nextInt() % 2) + 3;
            }

            if (petalsY[i] >= Constant.DRAW_HEIGHT || petalsY[i] < 0) {
                if (i < 6) {
                    petalsX[i] = Math.abs(rand.nextInt() % (Constant.DRAW_WIDTH / 4)) - Constant.DRAW_WIDTH / 2;
                    petalsY[i] = Math.abs(rand.nextInt() % (Constant.DRAW_HEIGHT / 2));
                } else {
                    petalsX[i] = Math.abs(rand.nextInt() % (Constant.DRAW_WIDTH / 2));
                    petalsY[i] = 0;
                }

            }

//            }
        }

    }
    /**
     * 绘制下雪效果
     */
    Random rand;
    int snows;
    int[] snowX, snowY;

    public void initSnow() {
        rand = new Random();
        snows = 200;
        effect_index = 0;
        snowX = new int[snows];
        snowY = new int[snows];
        for (int i = 0; i < snows; i++) {
            snowX[i] = rand.nextInt() % (Constant.DRAW_WIDTH / 2) + Constant.DRAW_WIDTH / 2;  //[-width/2..width/2]+width/2=>[0..width]
            snowY[i] = rand.nextInt() % (Constant.DRAW_HEIGHT / 2) + Constant.DRAW_HEIGHT / 2;  // abs[rand.nextInt()%width]
        }
    }

    public void drawBackSnow(Graphics g) {
        effect_index++;
        g.setColor(0xffffff);
        for (int i = 0; i < snows; i++) {
            g.drawLine(snowX[i], snowY[i], snowX[i] + 2, snowY[i]);
            g.drawLine(snowX[i] + 1, snowY[i] - 1, snowX[i] + 1, snowY[i] + 1);
            //第二种
            if (effect_index % 2 == 1) {
                snowX[i] += rand.nextInt() % 4;
                snowY[i] += Math.abs(rand.nextInt() % 2) + 2;
                if (snowX[i] >= Constant.DRAW_WIDTH) {
                    snowX[i] = 0;
                }
                if (snowX[i] < 0) {
                    snowX[i] = Constant.DRAW_WIDTH - 1;
                }
                if (snowY[i] >= Constant.DRAW_HEIGHT || snowY[i] < 0) {
                    snowX[i] = Math.abs(rand.nextInt() % Constant.DRAW_WIDTH);
                    snowY[i] = 0;
                }
            }
        }

    }

    /**
     * 切换场景
     * @param sRoamMapKeys
     * @param sRoamMapName 
     */
    public void changeScence(String sRoamMapKeys, String sRoamMapName) {
        if (sRoamMapKeys.equals("10101") || sRoamMapKeys.equals("10201")) {
            otherPlayerFlag = new Image[2];
            otherPlayerFlag[0] = ResManager.createImage(90000078);
            otherPlayerFlag[1] = ResManager.createImage(90000079);
        } else {
            otherPlayerFlag = null;
        }
        bInBattlefield = sRoamMapKeys.equals("10101") ? true : false;
        this.sRoamMapKeys = sRoamMapKeys;
        this.sRoamMapName = sRoamMapName;
        //#if NOKIAN73 || NOKIA_S40V3  || NORMAL_240_400 || MOTO || K790
        //#else
        if (MainLogic.uiEquipment.isopenset[18]) {
            byte byNewScenceWeatherType = this.getScenceWeatherType(sRoamMapKeys);
            if (byNewScenceWeatherType == -1) {
                this.byWeatherType = -1;
                this.clearWeatherRes();
            } else {
                if (byNewScenceWeatherType == this.byWeatherType) {
                    return;
                } else {
                    this.clearWeatherRes();
                    this.byWeatherType = byNewScenceWeatherType;
                    this.initWeather();
                }
            }
        } else {
            this.byWeatherType = -1;
            this.clearWeatherRes();
        }
        //#endif

    }

    /***********************************答题活动*******************************************/
    public void initQuestion() {
        //#if NOKIA_S60V5
         imgUiArray = new Image[9];
         imgUiArray[6] = ResManager.createImage(90000084);//方向键
         imgUiArray[7] = ResManager.createImage(90000085);//确定键
         imgUiArray[8] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        imgUiArray = new Image[6];
        //#endif
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgUiArray[0] = ResManager.createImage(90000017);
//# //            imgUiArray[0] = Tools.ZoomImage(imgUiArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
        imgUiArray[0] = ResManager.createImage(90000017);//背景图片
//#endif
        imgUiArray[1] = ResManager.createImage(90000080);//选择标记
        imgUiArray[2] = ResManager.createImage(90000081);//开始答题
        imgUiArray[3] = ResManager.createImage(90000043);//确定
        imgUiArray[4] = Tools.makeBlueMask();//蓝光
        imgUiArray[5] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 10, 100, 0x252525);//半透明背景图片
        sArray = new String[]{"智冠群雄", "行侠天下当文武双修。只要你才智过人，就可以在本小仙这里领走海量经验哦。",//0-1
            "每天", "点到", "点开放答题系统，每日可以回答", "个问题，答对问题获得相应的经验奖励。",//2-5
            "玩家等级达到", "级后方可进行答题活动。",//6-7
            "答对了。经验+", "累积答对", "题", "答错了。",//8-11
            "您放弃了答题。本次共答题", "道，", "答对", "答错", "累积获得经验", "点",//12-17
            "您还可以回答", "道题目，请在", "点的任意时间继续来答题。",//18 - 20
            "今日全部题目已经答完。本次共答题",//21
            "你才疏学浅，还要继续修炼啊，明日再来吧。",//22
            "不错不错，你资质上乘，假以时日必将才智过人。",//23
            "少侠才智过人，天下第一非你莫属，佩服佩服！",//24
            "、"};//25
        iArray = new int[]{0, 0, 0};//答题数量、答对题目数量、答错题目数量
        random = new Random();
        byUiState = 0;
        bUiKeyPressLock = false;
    }

    public void getQuestionInfo(byte[] data) {
        byData = data;
        sDataArray = new String[3];
        sDataArray[0] = sArray[1];
        sDataArray[1] = sArray[2] + data[0] + sArray[3] + data[1] + sArray[4] + data[2] + sArray[5];
        sDataArray[2] = sArray[6] + data[3] + sArray[7];
    }

    public void getQuestionRun(byte answerType, int exp, byte num, String questionTitle, String[] answers) {
        sDataArray = new String[answers.length + 2];
        byIndex = new byte[answers.length];
        if (answerType == 1) {//答对了
            bFlag = true;
            iArray[1]++;
            sDataArray[0] = sArray[8] + exp + sArray[9] + iArray[1] + sArray[10];
        } else if (answerType == 2) {//答错了
            bFlag = true;
            sDataArray[0] = sArray[11] + sArray[9] + iArray[1] + sArray[10];
        } else if (answerType == 3) {//第一次答题
            bFlag = false;
        }
        sDataArray[1] = num + sArray[25] + questionTitle;
        breakOrder(answers);
        iArray[2] = iArray[0] - iArray[1];
        iSelectIndex = 1;
        byUiState = 1;
    }

    public void getQuestionEnd(byte type, byte num, int exp, byte nums) {
        iArray[1] = num;
        iArray[2] = iArray[0] - iArray[1];
        sDataArray = new String[2];
        if (type == 1) {//放弃答题
            sDataArray[0] = sArray[12] + iArray[0] + sArray[13] + sArray[14] + iArray[1] + sArray[13] + sArray[15] + iArray[2]
                    + sArray[13] + sArray[16] + exp + sArray[17];
            sDataArray[1] = sArray[18] + nums + sArray[19] + byData[0] + sArray[3] + byData[1] + sArray[20];
            byUiState = 2;
        } else if (type == 2) {//答题结束
            sDataArray[0] = sArray[21] + iArray[0] + sArray[13] + sArray[14] + iArray[1] + sArray[13] + sArray[15] + iArray[2]
                    + sArray[13] + sArray[16] + exp + sArray[17];
            if (nums < 16) {
                sDataArray[1] = sArray[22];
            } else if (nums < 30) {
                sDataArray[1] = sArray[23];
            } else {
                sDataArray[1] = sArray[24];
            }
            byUiState = 3;
        }
    }

    public void breakOrder(String[] data) {
        int num = data.length;
        int temp = 0;
        byte[] byIndexTemp = new byte[data.length];
        for (int i = 0; i < byIndexTemp.length; i++) {
            byIndexTemp[i] = (byte) i;
        }
        for (int i = 0; i < data.length; i++) {
            temp = Math.abs(random.nextInt() % num);
            sDataArray[2 + i] = data[temp];
            data[temp] = data[num - 1];
            byIndex[i] = byIndexTemp[temp];
            byIndexTemp[temp] = byIndexTemp[num - 1];
            num--;
        }
        byIndexTemp = null;
    }

    public void drawQuestion(Graphics g) {
        int w = 0;
        int h = 0;
        switch (byUiState) {
            case 0://开始答题界面
                startX = Constant.UI_START_X + 0;
                startY = Constant.UI_START_Y + 0;
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[6], imgUiArray[7], imgUiArray[8], null, sArray[0]);
                 g.drawRegion(imgUiArray[3], 199, 79, 94, 24, Constant.TRANS_NONE,
                         Constant.UI_START_X + 258, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgUiArray[3], 100, 3, 45, 20, Constant.TRANS_NONE,
                         Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 199, 79, 94, 24, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 100, 3, 45, 20, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 307, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 h = Constant.END_LINE - 41;
                 startY = Constant.UI_START_Y + 41;
                //#else
//#                Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[4], imgUiArray[2], 0, 0, 46, 13,
//#                        imgUiArray[3], 49, 0, 23, 12, sArray[0], blackColor);
//#                h = Constant.DRAW_HEIGHT - 21 - 25;
//#                startY = Constant.UI_START_Y + 21;
                //#endif
                w = Constant.DRAW_WIDTH;
                Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[5], 0, 0, w, imgUiArray[5].getHeight(), Constant.TRANS_NONE);
                //#if NOKIA_S60V5
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                w = Constant.DRAW_WIDTH - 20;
                h = Tools.getParagraphHeight(sDataArray[0], w, h) + Tools.getParagraphHeight(sDataArray[1], w, h)
                        + Tools.getParagraphHeight(sDataArray[2], w, h);
                startX = Constant.UI_START_X + 10;
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - 41 - h >> 1);
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 21 - 25 - h >> 1);
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                for (int i = 0; i < sDataArray.length; i++) {
                    Tools.drawParagraph(g, startX, startY, w, sDataArray[i], selectColor, h, blackColor);
                    startY += Tools.getParagraphHeight(sDataArray[i], w, h);
                }
                break;
            case 1://答题ING
                startX = Constant.UI_START_X + 0;
                startY = Constant.UI_START_Y + 0;
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[6], imgUiArray[7], imgUiArray[8], null, sArray[0]);
                 g.drawRegion(imgUiArray[3], 1, 2, 47, 21, Constant.TRANS_NONE,
                         Constant.UI_START_X + 305, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgUiArray[3], 3, 104, 94, 25, Constant.TRANS_NONE,
                         Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 1, 2, 47, 21, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 3, 104, 94, 25, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 258, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 startY = Constant.UI_START_Y + 41;
                 h = Constant.END_LINE - 41;
                //#else
//#                Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[4], imgUiArray[3], 0, 0, 24, 12,
//#                        imgUiArray[2], 46, 0, 46, 13, sArray[0], blackColor);
//#                startY = Constant.UI_START_Y + 21;
//#                h = Constant.DRAW_HEIGHT - 21 - 25;
                //#endif
                w = Constant.DRAW_WIDTH;
                Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[5], 0, 0, w, imgUiArray[5].getHeight(), Constant.TRANS_NONE);
                startX = Constant.UI_START_X + 10;
                w = Constant.DRAW_WIDTH - 20;
                //#if NOKIA_S60V5
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                 startY = Constant.UI_START_Y + 41 + 10;
                //#else
//#                h = Constant.FONT_SMALL_HEIGHT;
//#                startY = Constant.UI_START_Y + 21 + 10;
                //#endif
                if (bFlag) {//绘制上次答题答案
                    Tools.drawParagraph(g, startX, startY, w, sDataArray[0], whiteColor, h, blackColor);
                    startY += Tools.getParagraphHeight(sDataArray[0], w, h) + 10;
                }
                //绘制题目
                Tools.drawParagraph(g, startX, startY, w, sDataArray[1], selectColor, h, blackColor);
                //绘制选项
                startY += Tools.getParagraphHeight(sDataArray[1], w, h);
                for (int i = 0; i < sDataArray.length - 2; i++) {
                    g.drawRegion(imgUiArray[1], 0, 0, 13, 13, Constant.TRANS_NONE, startX, startY, 0);
                    if (i == iSelectIndex - 1) {
                        g.drawRegion(imgUiArray[1], 13, 0, 13, 13, Constant.TRANS_NONE, startX, startY, 0);
                    }
                    Tools.drawParagraph(g, startX + 13 + 3, startY, w - 13 - 3, sDataArray[i + 2], selectColor, h, blackColor);
                    startY += Tools.getParagraphHeight(sDataArray[i + 2], w - 13, h);
                }
                break;
            case 2://放弃答题
                startX = Constant.UI_START_X + 0;
                startY = Constant.UI_START_Y + 0;
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[6], imgUiArray[7], imgUiArray[8], null, sArray[0]);
                 g.drawRegion(imgUiArray[3], 100, 105, 95, 24, Constant.TRANS_NONE,
                         Constant.UI_START_X + 257, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgUiArray[3], 100, 3, 45, 20, Constant.TRANS_NONE,
                         Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 100, 105, 95, 24, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 100, 3, 45, 20, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 307, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 startY = Constant.UI_START_Y + 41;
                 h = Constant.END_LINE - 41;
                //#else
//#                Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[4], imgUiArray[2], 92, 0, 46, 13,
//#                        imgUiArray[3], 49, 0, 23, 12, sArray[0], blackColor);
//#                startY = Constant.UI_START_Y + 21;
//#                h = Constant.DRAW_HEIGHT - 21 - 25;
                //#endif
                w = Constant.DRAW_WIDTH;
                Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[5], 0, 0, w, imgUiArray[5].getHeight(), Constant.TRANS_NONE);
                //#if NOKIA_S60V5
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                h = Tools.getParagraphHeight(sDataArray[0], w, h) + Tools.getParagraphHeight(sDataArray[1], w, h);
                startX = Constant.UI_START_X + 10;
                w = Constant.DRAW_WIDTH - 20;
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - 41 - h - 30 >> 1);
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 21 - 25 - h - 30 >> 1);
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                Tools.drawParagraph(g, startX, startY, w, sDataArray[0], whiteColor, h, blackColor);
                startY += Tools.getParagraphHeight(sDataArray[0], w, h) + 30;
                Tools.drawParagraph(g, startX, startY, w, sDataArray[1], whiteColor, h, blackColor);
                break;
            case 3://答题结束
                startX = Constant.UI_START_X + 0;
                startY = Constant.UI_START_Y + 0;
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[6], imgUiArray[7], imgUiArray[8], imgUiArray[3], sArray[0]);
                 startY = Constant.UI_START_Y + 41;
                 h = Constant.END_LINE - 41;
                //#else
//#                Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[4], imgUiArray[3], 0, 0, 24, 12,
//#                        imgUiArray[3], 49, 0, 23, 12, sArray[0], blackColor);
//#                startY = Constant.UI_START_Y + 21;
//#                h = Constant.DRAW_HEIGHT - 21 - 25;
                //#endif
                w = Constant.DRAW_WIDTH;
                Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[5], 0, 0, w, imgUiArray[5].getHeight(), Constant.TRANS_NONE);
                //#if NOKIA_S60V5
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                h = Tools.getParagraphHeight(sDataArray[0], w, h) + Tools.getParagraphHeight(sDataArray[1], w, h);
                startX = Constant.UI_START_X + 10;
                w = Constant.DRAW_WIDTH - 20;
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - 41 - h - 30 >> 1);
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 21 - 25 - h - 30 >> 1);
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                Tools.drawParagraph(g, startX, startY, w, sDataArray[0], whiteColor, h, blackColor);
                startY += Tools.getParagraphHeight(sDataArray[0], w, h) + 30;
                Tools.drawParagraph(g, startX, startY, w, sDataArray[1], whiteColor, h, blackColor);
                break;
        }
    }

    public void updateQuestion() {
        if (!bUiKeyPressLock) {
            switch (byUiState) {
                case 0://开始答题
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {
                        bUiKeyPressLock = true;
                        GameBean.BY_QUESTION = 2;
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_QUESTION_INFO, Constant.SOCKET_MSG_TYPE_LOGIC);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                        bUiKeyPressLock = true;
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                    }
                    break;
                case 1://答题ING
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        iSelectIndex = iSelectIndex == 1 ? sDataArray.length - 2 : iSelectIndex - 1;
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        iSelectIndex = iSelectIndex == sDataArray.length - 2 ? 1 : iSelectIndex + 1;
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {//确定答案
                        bUiKeyPressLock = true;
                        iArray[0]++;
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_QUESTION_RUN, Constant.SOCKET_MSG_TYPE_LOGIC);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//结束答题
                        bUiKeyPressLock = true;
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_QUESTION_END, Constant.SOCKET_MSG_TYPE_LOGIC);
                    }
                    break;
                case 2://放弃答题
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {//继续答题
                        bUiKeyPressLock = true;
                        iArray[0] = 0;
                        iArray[1] = 0;
                        GameBean.BY_QUESTION = 2;
                        MainLogic.getInstance().send(Constant.MSG_NET_CMD_QUESTION_INFO, Constant.SOCKET_MSG_TYPE_LOGIC);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                        bUiKeyPressLock = true;
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                    }
                    break;
                case 3://完成全部答题
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {//确定
                        bUiKeyPressLock = true;
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                        bUiKeyPressLock = true;
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                    }
                    break;
            }
        } else {
            bUiKeyPressLock = false;
        }
    }

    public void clearQuestion() {
        imgUiArray = null;
        sArray = null;
        iArray = null;
        sDataArray = null;
        byData = null;
        random = null;
        byIndex = null;
    }

    /*************************************打卡活动********************************************/
    public void initPunchClock() {
        //#if NOKIA_S60V5
         imgUiArray = new Image[9];
         imgUiArray[6] = ResManager.createImage(90000084);//方向键
         imgUiArray[7] = ResManager.createImage(90000085);//确定键
         imgUiArray[8] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        imgUiArray = new Image[6];
        //#endif
        //#if NOKIA_S40V3 || MOTO || K790
        //#elif NORMAL_240_400
//# //            imgUiArray[0] = ResManager.createImage(90000017);
//# //            imgUiArray[0] = Tools.ZoomImage(imgUiArray[0], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
        imgUiArray[0] = ResManager.createImage(90000017);//背景图片
        //#endif
        imgUiArray[1] = ResManager.createImage(90000080);//选择标记
        imgUiArray[2] = ResManager.createImage(90000081);//开始答题
        imgUiArray[3] = ResManager.createImage(90000043);//确定
        imgUiArray[4] = Tools.makeBlueMask();//蓝光
        imgUiArray[5] = Tools.makeTransparent(Constant.SCREEN_WIDTH, 10, 100, 0x252525);//半透明背景图片
        sArray = new String[]{"女娲降福", "七公主会根据你在神羿世界的时间给予你不同的物品奖励：",//0 - 1
            "可以通过选择查询奖励，查看当前可获得宝箱。", "在线时长每增加1小时，所获得的奖励会获得提升。",// 2 - 3
            "在线1小时，获得初级奖励；", "在线6小时，获得顶级奖励；", "在线时间越长，获得的奖励越丰厚",// 4 - 6
            "您今天的在线时间为分钟，现在可获得的奖励是。", "再过分钟，您可以领取的奖励是。"//7 - 8
        };
        byUiState = 1;
    }

    public void drawPunchClock(Graphics g) {
        int w = 0;
        int h = 0;
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        switch (byUiState) {
            case 1:
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[6], imgUiArray[7], imgUiArray[8], null, sArray[0]);
                 g.drawRegion(imgUiArray[3], 4, 131, 90, 23, Constant.TRANS_NONE,
                         Constant.UI_START_X + 262, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgUiArray[3], 100, 3, 45, 20, Constant.TRANS_NONE,
                         Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 4, 131, 90, 23, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
 //                g.drawRegion(imgUiArray[3], 100, 3, 45, 20, Constant.TRANS_NONE,
 //                        Constant.UI_START_X + 307, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 startY = Constant.UI_START_Y + 41;
                 h = Constant.END_LINE - 41;
                //#else
//#                Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[4], imgUiArray[2], 138, 0, 45, 13,
//#                        imgUiArray[3], 49, 0, 23, 12, sArray[0], blackColor);
//#                startY = Constant.UI_START_Y + 21;
//#                h = Constant.DRAW_HEIGHT - 21 - 25;
                //#endif
                w = Constant.DRAW_WIDTH;
                Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[5], 0, 0, w, imgUiArray[5].getHeight(), Constant.TRANS_NONE);
                //#if NOKIA_S60V5
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                w = Constant.DRAW_WIDTH - 20;
                h = Tools.getParagraphHeight(sArray[1], w, h) + Tools.getParagraphHeight(sArray[2], w, h)
                        + Tools.getParagraphHeight(sArray[3], Constant.FONT_SMALL.stringWidth(sArray[4]), h) + h * 2;
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - 41 - h >> 1);
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 21 - 25 - h >> 1);
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                Tools.drawParagraph(g, startX, startY, w, sArray[1], whiteColor, h, blackColor);
                startY += Tools.getParagraphHeight(sArray[1], w, h);
                w = Constant.FONT_SMALL.stringWidth(sArray[4]);
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
                Tools.drawShadowString(g, (byte) 1, sArray[4], startX, startY, selectColor, blackColor);
                startY += h;
                Tools.drawShadowString(g, (byte) 1, sArray[5], startX, startY, selectColor, blackColor);
                startY += h;
                Tools.drawParagraph(g, startX, startY, w, sArray[3], selectColor, h, blackColor);
                startY += (Tools.getParagraphHeight(sArray[3], w, h));
                w = Constant.DRAW_WIDTH - 20;
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
                Tools.drawParagraph(g, startX, startY, w, sArray[2], whiteColor, h, blackColor);
                break;
            case 2:
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgUiArray[0], imgUiArray[6], imgUiArray[7], imgUiArray[8], null, sArray[0]);
                 g.drawRegion(imgUiArray[3], 1, 2, 47, 21, Constant.TRANS_NONE,
                         Constant.UI_START_X + 255, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgUiArray[3], 144, 131, 50, 23, Constant.TRANS_NONE,
                         Constant.UI_START_X + 302, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 g.drawRegion(imgUiArray[3], 101, 131, 93, 23, Constant.TRANS_NONE,
                         Constant.UI_START_X + 8, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 38, 0);
                 startY = Constant.UI_START_Y + 41;
                 h = Constant.END_LINE - 41;
                //#else
//#                Tools.drawFrame(g, startX, startY, imgUiArray[0], null, imgUiArray[4], imgUiArray[2], 229, 0, 46, 13,
//#                        imgUiArray[2], 183, 0, 46, 12, sArray[0], blackColor);
//#                startY = Constant.UI_START_Y + 21;
//#                h = Constant.DRAW_HEIGHT - 21 - 25;
                //#endif
                w = Constant.DRAW_WIDTH;
                Tools.drawTilePic(g, (byte) 2, startX, startY, h, imgUiArray[5], 0, 0, w, imgUiArray[5].getHeight(), Constant.TRANS_NONE);
                //#if NOKIA_S60V5
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                w = Constant.DRAW_WIDTH - 20;
                h = Tools.getParagraphHeight(sArray[6], w, h) + Tools.getParagraphHeight(sArray[7], w, h)
                        + Tools.getParagraphHeight(sArray[8], w, h);
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - w >> 1);
                //#if NOKIA_S60V5
                 startY = Constant.UI_START_Y + (Constant.END_LINE - 41 - h >> 1);
                 h = Constant.FONT_SMALL_HEIGHT + 10;
                //#else
//#                startY = Constant.UI_START_Y + (Constant.DRAW_HEIGHT - 21 - 25 - h >> 1);
//#                h = Constant.FONT_SMALL_HEIGHT;
                //#endif
                Tools.drawParagraph(g, startX, startY, w, sArray[6], whiteColor, h, blackColor);
                startY += Tools.getParagraphHeight(sArray[6], w, h);
                Tools.drawParagraph(g, startX, startY, w, sArray[7], selectColor, h, blackColor);
                startY += Tools.getParagraphHeight(sArray[7], w, h);
                Tools.drawParagraph(g, startX, startY, w, sArray[8], selectColor, h, blackColor);
                break;
        }
    }

    public void updatePunchClock() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            return;
        }
        switch (byUiState) {
            case 1:
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {
                    GameBean.BY_PUNCH_CLOCK = 1;
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_GAME_TIME, Constant.SOCKET_MSG_TYPE_LOGIC);
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                    MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                }
                break;
            case 2:
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)) {
                    GameBean.BY_PUNCH_CLOCK = 2;
                    MainLogic.getInstance().send(Constant.MSG_NET_CMD_GAME_TIME, Constant.SOCKET_MSG_TYPE_LOGIC);
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                    MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                    byUiState = 1;
                    GameBean.BY_PUNCH_CLOCK = -1;
                }
                break;
        }
    }

    public void clearPunchClock() {
        imgUiArray = null;
        sArray = null;
    }

    public void initChangePasswd() {
        //弹出层的标题
        try {
            //#if NOKIA_S60V5
             this.imgUiArray = new Image[5];
             this.imgUiArray[0] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
             this.imgUiArray[1] = ResManager.createImage(90000044);
             this.imgUiArray[2] = ResManager.createImage(90000043);//文字
             this.imgUiArray[3] = ResManager.createImage(90000086);
             this.imgUiArray[4] = ResManager.createImage(90000090);
            //#else
//#            this.imgUiArray = new Image[2];
//#            this.imgUiArray[0] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
//#            this.imgUiArray[1] = ResManager.createImage(90000044);
            //#endif
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
//            System.out.print("弹出层图片载入异常");
        }
        Rms.loadGame(Constant.RMS_LOGIN_USENAME_PASSWORD);
        Rms.loadGame(Constant.RMS_SUPER_PASSWD);
        this.sArray = new String[]{"密码修改提示", ""};
        this.sArray[1] = "您是快速注册玩家，您注册的账号为：<k" + GameBean.STR_CMD_LOGIN_USENAME + ">，密码是：<k" + GameBean.STR_CMD_LOGIN_PASSWORD;
        this.sArray[1] += ">，二级密码是：<k" + GameBean.STR_CMD_SUPER_PASSWORD + ">！为了保证您的切身利益及帐号密码安全，强烈建议您现在修改密码和二级密码.";
        this.sArray[1] += "您现在要修改您的密码和二级密码么？";
        //#if NOKIA_S60V5
         this.menuWidth = 320;
         this.menuH = (short) (Tools.getParagraphHeight(this.sArray[1], this.menuWidth - 20, Constant.FONT_SMALL_HEIGHT + 1) + 50);
        //#elif NOKIA_E72
//#         this.menuWidth = 302;
//#         this.menuH = (short) (Tools.getParagraphHeight(this.sArray[1], this.menuWidth - 20, Constant.FONT_SMALL_HEIGHT + 1) + 30);
        //#else
//#        this.menuWidth = 232;
//#        this.menuH = (short) (Tools.getParagraphHeight(this.sArray[1], this.menuWidth - 20, Constant.FONT_SMALL_HEIGHT + 1) + 30);
        //#endif

    }

    public void drawChangePasswd(Graphics g) {
        if (this.byUiState == 0) {
            Tools.drawPopUp(g, (byte) 4, Constant.UI_START_X + ((Constant.DRAW_WIDTH - this.menuWidth) >> 1), Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - this.menuH) >> 1), this.menuWidth, this.menuH, this.imgUiArray[0], 0x989898, this.imgUiArray[1], 0, 0, 22, 10, this.imgUiArray[1], 22, 0, 21, 10, this.sArray[0], this.sArray[1]);
            //#if NOKIA_S60V5
             Tools.drawBottom(g, this.imgUiArray[2], this.imgUiArray[4], this.imgUiArray[3]);
            //#endif
        }
    }

    public void updateChangePasswd() {
        switch (this.byPopUpState) {
            case 0:
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                        || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                    //同意修改密码
                    this.byUiState = 1;
                    MainLogic.getInstance().inputInterFace.setInputInterFace(this.byUiState, "密码和二级密码修改");
                    MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                    //拒绝
                    MainLogic.getInstance().pushState(Constant.GAME_UI_ROAM, true);
                }
                break;
            case 1:
                break;

        }
        MainCanvas.clearInput();
    }

    public void clearChangePasswd() {
        this.sArray = null;
        this.imgUiArray = null;
    }
    
    
    //////////////////////
    //
    public static int[][] mNearPlayerListTouchRect;
    public static int[][] mNearPlayerListPopOperationTouchRect;
    public static final int START_Y = 87;
    public static final int SPACE = 20;
    
    
    public void setNearPlayerListTouchRect()
    {
    	int count = bySelectNum - 1;
    	if(count  > 0)
    	{
    		mNearPlayerListTouchRect = new int[count][];
    		for(int i = 0; i < count; i++)
    		{
    			mNearPlayerListTouchRect[i] = new int[]{
    					0,START_Y + 2*SPACE * i,360,SPACE
    			};
    		}
    	}
    }
    public void checkTouchNearPlayerList(int x, int y)
    {
//    	System.out.println("iSelectIndex = " + iSelectIndex);
//    	System.out.println("bySelectNum = " + bySelectNum);

    	
    	if(byUiState == 1)
    	{
    		mNearPlayerListPopOperationTouchRect = Tools.getPopOperationRect(imgUiArray[5], 0x989898, 0x7c7c7c, menu, menuWidth, menuH,
                 menuSpaceH, whiteColor, selectColor, menuSelectIndex, 0, 0);
    		int touched = MainCanvas.checkTouch(x, y, mNearPlayerListPopOperationTouchRect);
    		if(touched >= 0)
    		{
    			menuSelectIndex = (byte) (touched + 1);
    			MainCanvas.pressFire();
    		}
    		else
    		{
    			MainCanvas.checkSoftKey();
    		}
    	}
    	else
    	{
	    	if(mNearPlayerListTouchRect != null)
	    	{
		    	 int touched = MainCanvas.checkTouch(x, y, mNearPlayerListTouchRect);
				 if(touched >= 0)
				 {
					 iSelectIndex = touched + 2;
					 MainCanvas.pressFire();
				 }
				 else
	 			 {
	 				MainCanvas.checkSoftKey();
	         	 }
	    	}
	    	else
			 {
				MainCanvas.checkSoftKey();
	    	 }
    	}
    }
    ////////////////////
    //
    public static final int BOX_SIZE = 40;
    public static final int SPACE_X = 27;
    public static int[][] mOtherPlayerLookedTouchRect = new int[][]{
    	//top
    	{0,80,180,50},{180,80,180,50},
    	//
    	{25,138,BOX_SIZE,BOX_SIZE},
    	{25 + BOX_SIZE + SPACE_X,138,BOX_SIZE,BOX_SIZE},
    	{25 + (BOX_SIZE + SPACE_X) * 2,138,BOX_SIZE,BOX_SIZE},
    	{25 + (BOX_SIZE + SPACE_X) * 3,138,BOX_SIZE,BOX_SIZE},
    	{25 + (BOX_SIZE + SPACE_X) * 4,138,BOX_SIZE,BOX_SIZE},
    	
    	{25,197,BOX_SIZE,BOX_SIZE},
    	{25 + BOX_SIZE + SPACE_X,197,BOX_SIZE,BOX_SIZE},
    	{25 + (BOX_SIZE + SPACE_X) * 2,197,BOX_SIZE,BOX_SIZE},
    	{25 + (BOX_SIZE + SPACE_X) * 3,197,BOX_SIZE,BOX_SIZE},
    	{25 + (BOX_SIZE + SPACE_X) * 4,197,BOX_SIZE,BOX_SIZE},
    	
    	
    	
    };
    public void checkTouchOtherPlayerLooked(int x, int y)
    {
    	System.out.println("iSelectIndex = " + iSelectIndex);
    	System.out.println("iSubSelectIndex = " + iSubSelectIndex);
    	
   	 int touched = MainCanvas.checkTouch(x, y, mOtherPlayerLookedTouchRect);
	 if(touched >= 0)
	 {
		 if(touched == 0)
		 {
                
		 }
		 else if(touched == 1)
		 {
			 pet.getOtherPlayerPetEquip(GameBean.L_PLAYER_ID, otherPlayerName);
		 }
		 else
		 {
			 if(touched < 7)
			 {
				 iSelectIndex = 2;
				 iSubSelectIndex = touched - 1;
			 }
			 else if(touched < 12)
			 {
				 iSelectIndex = 3;
				 iSubSelectIndex = touched - 6;
			 }
		 }
	 }
	 else
	 {
		 MainCanvas.checkSoftKey();
	 }
    }
    
    
    //////////////////////
    //
    
//    public static final int START_Y = 125;//95
//    public static final int MENU_H = 40;
//    public static final int SPACE_Y = 20;
    public void setReviveTouchRect()
    {
    	if(menu == null || menu.length <= 0)
    		return;
    	int count = menu.length-1;
    	mReviveTouchRect = new int[count][];
    	int startY = 95;
    	if(count == 2)
    	{
    		startY = 125;
    	}
    	for(int i = 0; i < count; i++)
    	{
    		mReviveTouchRect[i] = new int[]{90,startY + (40 + 20) * i,180,40};
    	}
    }
    public static int[][] mReviveTouchRect = null;
    
    public void checkTouchRevive(int x, int y)
    {
    	
    	if(mReviveTouchRect != null)
    	{
    		 int touched = MainCanvas.checkTouch(x, y, mReviveTouchRect);
    		 if(touched >= 0)
    		 {
    			 iSelectIndex = touched+1;
    			 MainCanvas.pressFire();		 
    		 }
    		 else
    		 {
    			 MainCanvas.checkSoftKey();
    		 }
    	}
    	 else
		 {
			 MainCanvas.checkSoftKey();
		 }
    }
}
